Re: Sql results
| From: | Alberto Wagner | Date: | Sun, 31 Mar 2002 00:44:29 +0000 |
| Subject: | Re: Sql results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90860@lists.php.net to get a copy of this message | ||
But I Want a way to do something if there isn't any result
31/03/2002 01:52:10, Jason Wong <php-general@gremlins.com.hk> 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
>
>
>