Page 1 of 1

pagination error

Posted: Sun Nov 01, 2009 12:46 am
by adsegzy
Hello there,

Please am having problem with this below pagination code

Code: Select all

 
MySQL's COUNT() function. $result = mysql_query("SELECT COUNT(*) AS total_entries FROM products") or die(mysql_error()); $row = mysql_fetch_row($result); $total_entries = $row[0];
 
$entries_per_page = 3;
 
if(isset($_GET['page_number'])) { $page_number = $_GET['page_number']; } else { $page_number = 1; } 
 
$total_pages = ceil($total_entries / $entries_per_page);
 
$result = mysql_query("SELECT * FROM products LIMIT $offset, $entries_per_page") or die(mysql_error()); while($obj = mysql_fetch_object($result)) { // Display the data however you want here. print <<id - $obj->name - $obj->description<br>
 
EOD; }
 
for($i = 1; $i <= $total_pages; $i++) { if($i == $page_number) { // This is the current page. Don't make it a link. print "$i "; } else { // This is not the current page. Make it a link. print " <a href="products.php?page_number=$i">$i</a> "; } }
 
 
the line generating the error is

Code: Select all

EOD; }
i have tried all i can but didnt work. kindly help me out.

Re: pagination error

Posted: Sun Nov 01, 2009 1:26 am
by requinix
That code is completely screwed up. Get another copy of it from wherever you downloaded it or copy/pasted it or whatever.