I am to php and I am trying to make a page where you can see the public uploads that are stored in a mysql server.
Out of not where the code I have been using starts giving me an error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'public' in 'where clause'
I am trying to see how many rows in my db have 'public'
// Find out how many items are in the table
$p = 'public';
$total = $db->query("SELECT COUNT(*) FROM uploads WHERE world_access = $p")->fetchColumn();
I don't know if it is the php or the sql.
// Prepare the paged query
$stmt = $db->prepare('SELECT * FROM uploads WHERE world_access = :y ORDER BY upload_time DESC LIMIT :limit OFFSET :offset');
// Bind the query params
$stmt->bindParam(':y', $p, PDO::PARAM_INT);
$stmt->bindParam(':limit', $limit, PDO::PARAM_INT);
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
pagination by Simple PHP Pagination script