Only the first page works
When i click the links to pages
I get this error
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster. Error 404 localhost Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4
This is my code
<?php
//connect to our DB
mysql_connect( 'localhost', 'root', 'password') ;
mysql_select_db( 'test1' ) ;
//preparing our variable.
if( !isset( $_GET['p'] ) ) {$_GET['p']=0;}
$per_page= 6 ;
$sql= " SELECT name FROM pagination " ;
$sql2= " SELECT name FROM pagination ORDER BY id DESC LIMIT ".$_GET['p']."," . $per_page;
$query= mysql_query ( $sql2 ) ;
$rows= mysql_num_rows ( mysql_query ( $sql ) ) ;
$page= ceil ( $rows / $per_page ) ;
while( $fetch= mysql_fetch_assoc( $query ) ) {
echo '<p>' . $fetch['name'] . '</p>' ;
}
for( $i=0;$i<$page;$i++ ){
echo' <a href="index.php?p='. ( $i * $per_page ) . '">'. ( $i + 1 ) .'</a> ' ;
}
?>