Re: Finding existence of a value in a table
| From: | CC Zona | Date: | Wed, 14 Mar 2001 00:37:25 +0000 |
| Subject: | Re: Finding existence of a value in a table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43739@lists.php.net to get a copy of this message | ||
In article <3AAEB627.712ABC23@oit.edu>, gearond@OIT.EDU (Dennis Gearon)
wrote:
> I would like to return ONE ROW if possible from a query that would tell
> me
> whether a value exists in a table.
If the query could result in more than one record, but you only want to see
one, 'limit 1' is helpful.
> SELECT FieldValueIn, COUNT(*) FROM TableOfInterest WHERE
> FieldValueIn=ValueOfInterest GROUP BY FieldValueIn;
>
> I can't seem to figure out how to test the return results to see if
> there is no rows with that value.
http://www.php.net/mysql-num-rows
--
CC