1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    I know this is going to be an easy one... but how do I display the number of "results" that come up when a person queries my database...

    example script:

    $result = mysql_query("SELECT * FROM $state WHERE City = '$cities'",$db);

    if ($myrow = mysql_fetch_array($result)) {

    echo "<table border=0 cellpadding=3 cellspacing=1>n";

    echo "
    <td colspan='3' bgcolor='#0000ff'>There are $i listings from your search.</td>
    <tr bgcolor='#0000ff'>
    <td><font COLOR='#FFCC00'><center><b>Name</b></center></font></td><td><font COLOR='#FFCC00'><center><b>Location</b></center></font></td><td><font COLOR='#FFCC00'><center><b>Hours</b></center></font></td></tr>n";

    do {
    if (is_int($i/2))

    printf("<tr><td bgcolor='#c8c8ff'><a href = 'daycare.php3' value = 'name'>%s</a></td><td bgcolor='#9797ff'>%s</td><td bgcolor='#c8c8ff'>%s</tr>n", $myrow["Name"], $myrow["Location"], $myrow["Hours"]);

    else printf("<tr><td bgcolor='#9797ff'><a href = 'daycare.php3'>%s</a></td><td bgcolor='#c8c8ff'>%s</td><td bgcolor='#9797ff'>%s</tr>n", $myrow["Name"], $myrow["Location"], $myrow["Hours"]);

    } while ($myrow = mysql_fetch_array($result));

    echo "</table>n";

    } else {

    echo "Sorry, no records were found!";

    For some reason... I can't get it to work right where I can put the number of results at the top of the page...

    Please help me...
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    $count = mysql_num_rows($result);

  4. #3
  5. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Thank you PAV... I knew it was going to be an easy one... But I couldn't find the right array...

Similar Threads

  1. counting line numbers and differences between them
    By baelnorn in forum Perl Programming
    Replies: 1
    Last Post: January 1st, 2004, 01:33 PM
  2. Counting number of words in ".txt",".doc", and ".pdf" files.
    By jacob_kochi2 in forum PHP Development
    Replies: 2
    Last Post: October 19th, 2003, 11:04 PM
  3. Complex Counting ?Grouping? challenge
    By Tbull in forum MySQL Help
    Replies: 2
    Last Post: January 9th, 2003, 12:39 PM
  4. Replies: 6
    Last Post: July 25th, 2002, 07:19 PM
  5. counting the contents of a directory
    By baddy in forum PHP Development
    Replies: 1
    Last Post: July 17th, 2002, 12:06 PM

IMN logo majestic logo threadwatch logo seochat tools logo