Re: Getting rows in a db...
| From: | Richard Lynch | Date: | Thu, 02 Aug 2001 05:57:25 +0000 |
| Subject: | Re: Getting rows in a db... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60841@lists.php.net to get a copy of this message | ||
Yes, if your $conn is valid in the first place, and your SQL is valid.
I think 'table' is a reserved word, so as-is, it won't work.
Add some error-checking code to see what MySQL is saying about your
connection and SQL.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Chris Cocuzzo <cuzo@mediaone.net>
Newsgroups: php.general
To: <php-general@lists.php.net>
Sent: Thursday, August 02, 2001 12:27 AM
Subject: [PHP]Getting rows in a db...
> hey-
>
> if I do this:
>
> $query = "SELECT user FROM table WHERE cat='band'";
> $result = mysql_query($query,$conn);
> $rows = mysql_num_rows($result);
>
> will I get something back from the $rows variable, or am I using the
> mysql_num_rows() function incorrectly. What I'm trying to do is get the
> number of rows returned as a result of that specific sql statement and
> query.
>
> thanks
> chris
>