Re: Why this doesn't work ?
| From: | Richard Lynch | Date: | Tue, 25 Oct 2005 02:32:57 +0000 |
| Subject: | Re: Why this doesn't work ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224604@lists.php.net to get a copy of this message | ||
On Mon, October 24, 2005 12:25 pm, Mário Gamito wrote:
> ---
> $query = "SELECT COUNT (login) FROM WHERE login = '$login'";
> $result = mysql_query($query);
> mysql_fetch_row($result);
> ---
>
> It gives me
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
> result resource in /var/www/html/registar_action.php on line 22
First, I'm going to give you a fish:
... FROM WHERE ...
Which MySQL database TABLE is it that you think you are looking in?
You have to tell it which table to look in.
Now I'm gonna teach you to catch fish:
Change your middle line to:
$result = mysql_query($query) or die("<br />$query<br />" .
mysql_error());
That will get PHP and MySQL to TELL YOU what's wrong, instead of just
saying "Something's wrong"
--
Like Music?
http://l-i-e.com/artists.htm