Re: Sql results
| From: | Jason Wong | Date: | Sun, 31 Mar 2002 04:52:10 +0000 |
| Subject: | Re: Sql results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90856@lists.php.net to get a copy of this message | ||
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.
*/