Re: Why this doesn't work ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux