forumnz Posted January 25, 2008 Share Posted January 25, 2008 How do I add num_rows into this so that I can count the results? Code snippet: <?php $sql = "SELECT * FROM fflists WHERE $op='$trim' AND (keywords LIKE '%$key%' OR business_name LIKE '%$key%') AND (c1 LIKE '%$cuis%' OR c2 LIKE '%$cuis%' OR c3 LIKE '%$cuis%' OR c4 LIKE '%$cuis%' OR c5 LIKE '%$cuis%') ORDER BY keywords ASC"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $name = $row['business_name']; $a = $row['id']; echo "<a class=two href=http://www.foodfinder.co.nz/Browse/Listing/?id=" . $a . ">" . $name . "</a><br>"; } } ?> Thanks, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/87686-solved-num-rows/ Share on other sites More sharing options...
revraz Posted January 25, 2008 Share Posted January 25, 2008 $result = mysql_query($sql) or die(mysql_error()); $numrows = mysql_num_rows($result); echo $numrows; while($row = mysql_fetch_array($result)) Quote Link to comment https://forums.phpfreaks.com/topic/87686-solved-num-rows/#findComment-448531 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.