justinh Posted November 11, 2008 Share Posted November 11, 2008 $count = mysql_num_rows($result); while($hey = mysql_fetch_array($result)){ if ($count > 2){ for($count; $count = 0; $count--){ if ($count = 1){ echo $hey['firstname']."<a href=\"moreinfo.php\">[...]</a><br>"; } else { echo $hey['firstname']."<br>"; } } } else { echo $hey['firstname']."<br>"; } } echo "</td>"; Trying to get if $count has more than 3 results, It displays 2 results and at the end adds [...] to see more results. Anyone have any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/132313-having-some-trouble/ Share on other sites More sharing options...
sasa Posted November 11, 2008 Share Posted November 11, 2008 try <?php $count = mysql_num_rows($result); $count1 = 0; while($hey = mysql_fetch_array($result)){ echo $hey['firstname']; $count1++; if ($count1 == 2 and $count > 2){ echo "<a href=\"moreinfo.php\">[...]</a><br>"; break; } } echo '</td>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/132313-having-some-trouble/#findComment-687888 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.