Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Number of Records Returned

    Any tips on how to count up the number of records returned from a search ?

    Thanks

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    SELECT COUNT(*) FROM TABLENAME WHERE FIELDNAME = 'foobar';
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!

  • #4
    New Coder
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or if you wish to know how many rows there are in the result set (the results of your query).
    PHP Code:
    $sql "SELECT COUNT(*) FROM TABLENAME WHERE FIELDNAME = 'foobar'";
    $result mysql_query($sql);
    $numRows mysql_num_rows($result); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •