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
Related Q & A:
- Are SQL Injection vulnerabilities in a PHP application acceptable if mod_security is enabled?Best solution by Programmers
- How can I optimize this dynamic SQL query in oracle with PL/SQL?Best solution by docs.oracle.com
- How to prevent an SQL injection in PHP?Best solution by Stack Overflow
- Can I estimate the row count of a large mysql table using the disk space?Best solution by Database Administrators
- How can I get the count in SQL?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.