How to reset row in PHP?

Php my sql display row count?

  • <?php include ("dbConnect.php"); echo "<h1>Choose an artist</h1>"; $letters="abcdefghijklmnopqrstuvwxyz0123… echo "<div class=\"bigMargin\">"; for ($i=0; $i<=35; $i++) { $letter=substr($letters,$i,1); $dbQuery="select * from artists where name like '%$letter' order by name asc"; $dbResult=mysql_query($dbQuery); if (mysql_num_rows($dbResult)>0) echo "<a href=\"#\" onclick=\"listArtists('$letter')\">$lett… "; else echo "$letter "; } echo "</div>"; ?> Does anyone know where abouts in this piece of code i could place $num_rows=mysql_num_rows($dbResult); echo"<p>$num_rows</p>" to print the number of rows that appear. I can't figure it out.

  • Answer:

    Put the after $dbResult=mysql_query($dbQuery); ... $dbResult=mysql_query($dbQuery); $num_rows=mysql_num_rows($dbResult); echo"<p>$num_rows</p>"; if ($num_rows>0) ...

Sam at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.