Skip to content

Instantly share code, notes, and snippets.

<?php
$conn = mysql_connect("localhost", "username", "password" ) or die (mysql_error()) ;
mysql_select_db("database", $conn);
if( !isset( $_GET['p']) ) {$_GET['p']=0;} // Ideally check if it's numeric also
$per_page= 9;
$sql= "SELECT * FROM black"; // You don't use this one ...
// The first int in LIMIT specifies the start row, thus you need to do $_GET['p'] * $per_page
// More importantly you're trying to use both ID and IMAGE columns from your database, but you only select image ???
$sql2= "SELECT * FROM black ORDER BY id Asc LIMIT ".$_GET['p'] * $per_page."," . $per_page;
$query= mysql_query( $sql2 );