
Originally Posted by
HillBilly
dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT 5 OFFSET " . $offset);
to
dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT 5 OFFSET ".$offset."");
Try that.
Also why you use offset and not the LIMIT 0, 25 -> 25, 50 etc?
So I would do it like:
$page = 0;
if(isset($_GET['page']))
$page = abs((int) $_GET['page']);
$min_comments = $page * 5;
$max_comments = $min_comments + 5;
dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT $min_comments, $max_comments");
Thanks for your help man , I appreciate it. I tired your code
Code:
dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT 5 OFFSET ".$offset."");
Still gave the same error , and I followed your advice and did this :
Code:
<?php
$getComments = dbquery("SELECT * FROM site_news_comments WHERE article='" . $articleid . "'");
$page = 0;
if(isset($_GET['page']))
$count = mysql_num_rows(getComments);
$page = abs((int) $_GET['page']);
$min_comments = $page * 5;
$max_comments = $min_comments + 5;
$getComments = dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT $min_comments, $max_comments");
?>
ans now I get this Screenshot by Lightshot
There's supposed to be 3 comments there , it shows the count as 1 and there's no comment or user.