try this, it sees if there is a result, and you can then proceed to do what you need to do.
if (mysql_num_rows($result) == 1) //match found { //do something here; } // no match found else { //do something here; } >From: Alberto Wagner <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: [PHP] Sql results >Date: Sat, 30 Mar 2002 21:44:29 -0300 > >But I Want a way to do something if there isn't any result > > > >31/03/2002 01:52:10, Jason Wong <[EMAIL PROTECTED]> wrote: > > >On Sunday 31 March 2002 07:29, Alberto Wagner wrote: > >> $Sql_Query_Login Returns an empty mysql array like: > >> > >> $Sql_Query_Login = Mysql_Query("SELECT Nome FROM users WHERE User = > >> 'Anyone'") > >> > >> There isn't a user if name Anyone... > >> > >> Why > >> > >> If (!$Sql_Query_Login) { > >> Echo "Ninguem"; > >> } > >> > >> Is returning False? > > > >mysql_query() returns a resource id, which is a *pointer* to the results >and > >not the actual results themselves. > > > >To get at the actual results you need to follow up with one of: > > > >mysql_fetch_array() > >mysql_fetch_row() > >mysql_fetch_assoc() > > > >See manual for details and examples. > > > >Also you should put some error-checking in your code as per the examples >in > >the manual. > > > > > >-- > >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > >/* > >Bennett's Laws of Horticulture: > > (1) Houses are for people to live in. > > (2) Gardens are for plants to live in. > > (3) There is no such thing as a houseplant. > >*/ > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php