Click to See Complete Forum and Search --> : test to see if query returns a value


psdeveloper
01-15-2009, 12:39 PM
I have a php webform with a single textbox that will qurey a MySql table. I like to know if there is a value returned from the query.

Select cEmail from
tblEmal
Where cEmail = $cEmail;

How do I test to see if the email the user enters in the textbox, is in the table?

Thanks

chazzy
01-15-2009, 06:28 PM
you could use


select count(*) from tblEmal Where cEmail = $cEmail;

psdeveloper
01-15-2009, 07:15 PM
would this work?

if (!$result_1)
{
die('Sorry, could not query the database! result_1<br/>'.mysql_error());
}