Comments Link?

I want the link to only show if there are more rows to show then that are already being shown… What is the problem with this?
[php] <?php
$highest = mysql_num_rows($query3);
if (($to != “”) and ($from != “”)){
$to = $to + 20;
$from = $from + 20;
} else {
$to = 20;
$from = 0;
$to = $to + 20;
$from = $from + 20;
};
if ($highest > $to){
?>
<a href=“index.php?pid=<?php echo $blog_id; ?>&<?php echo "to=$to&from=$from"; ?>”>Read more comments…
<?php
};
?>[/php]

Hi,

replace this link format “Read more comments…

Still hasn’t fixed it, i need the link to only appear when there’s more comments to be shown and not appear when there isn’t more to be shown… Any ideas?

Maybe you could try echoing the whole link rather than trying to be fancy with the cutting off of the PHP tags in between?

So…


if ($highest > $to){

echo "<a href='index.php?pid=" . $blog_id . "& . "to=" . $to . "&from=" . $from . ">Read more comments..</a>";

}

Also, you shouldn’t need a semi-colon after the closing if statement brackets.

Still not, it’s not showing at all unless i reverse

[php]if ($highest > $to){[/php]

to

[php]if ($highest < $to){[/php]

But then it shows 24/7 rather then only showing when there’s more comments to be shown?

Fixed it…

[php] <?php
$query4 = mysql_query(“SELECT * FROM comments WHERE id=’$blog_id’”);
$highest = mysql_num_rows($query4);
if (($to != “”) or ($from != “”)){
$to_old = $to;
$to = $to + 20;
$from = $to_old;
} else {
$to_old = 20;
$to = 20;
$from = 0;
$to = $to + 20;
$from = $from + 20;
};
if ($highest > $to_old){

						echo "<a href='index.php?pid=" . $blog_id . "&to=" . $to . "&from=" . $from . "'>Read more comments..</a>";

					}
					?>[/php]

Awesome. Glad you got it to work. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service