|
Posted by Phillip Oertel on 10/24/05 20:49
hi mario,
first of all, make sure that your query works from the mysql console or
phpmyadmin or some other tool (copy-paste the query from the code and
replace $loging with something reasonable).
then try the following:
$query = "SELECT COUNT (login) FROM formacao WHERE login = '$login'";
// check to see if the $login variable has been filled in -
// maybe $login is empty?
echo $query;
$result = mysql_query($query);
if (!$result) {
// mysql will tell you what's wrong
echo mysql_error();
}
mysql_fetch_row($result);
and btw. mysql_fetch_row() doesn't require a connection resource, it
will default to the last opened when none is given.
so you only need to give the 2nd parameter if you have more than one
mysql-db connection open.
regards,
phillip
---
Mário Gamito schrieb:
> Hi,
>
> Why this doesn't work ?
>
> ---
> $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
>
> Any help would be apreciated.
>
> Warm Regards,
> Mário Gamito
Navigation:
[Reply to this message]
|