Skip to content

Instantly share code, notes, and snippets.

Created Apr 24, 2012
Embed
What would you like to do?
<?php
$conn = mysql_connect("localhost", "username", "password" ) or die (mysql_error()) ;
mysql_select_db("database", $conn);
if( !isset( $_GET['p']) ) {$_GET['p']=0;}
$per_page= 9;
$sql= "SELECT * FROM black";
$sql2= "SELECT image FROM black ORDER BY id Asc LIMIT ".$_GET['p']."," . $per_page;
$query= mysql_query( $sql2 );
$rows= mysql_num_rows( mysql_query ( $sql ) );
$pages= ceil ( $rows / $per_page );
while( $fetch= mysql_fetch_assoc( $query) ){
echo '<a href="chaos_request.php?id='.$_GET['id'].'"><img src="'.$fetch['image'].'"/></a>';
echo "<br/>" ;
}
for( $i=0;$i<$pages;$i++){
echo '<a href="chaos.php?p='. ( $i * $per_page ) .'">'. ($i + 1 ) ."</a> ";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment