RE: [PHP-DB] mysql_connect returning error message
| From: | Craig Vincent | Date: | Thu, 20 Jul 2000 12:46:12 +0000 |
| Subject: | RE: [PHP-DB] mysql_connect returning error message | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1327@lists.php.net to get a copy of this message | ||
<snip>
> > $dblink = mysql_connect("<hostname>", "<user>",
> > "<password>");
> >
> > if I echo $dblink it returns the message "Resource id #1"
> >
> > Warning: Supplied argument is not a valid MySQL-Link resource in
> > (Then/it/lists/the/filename and line #)
</snip>
Your first objective is to find out what the actual error is :)
$dblink = mysql_connect("<hostname>", "<user>",
"<password>");
echo mysql_error();
mysql_db_query ("foo","SELECT * FROM bar");
echo mysql_error();
This will have PHP spurt out any error messages from the MySQL server (which
no doubt will lead you to the true source of the problem). BTW, assigning a
variable to contain the link identifier for mysql_connect is unnecessary if
this will be the only mysql connection running in that PHP script.
Sincerely,
Craig Vincent