RE: Error?
| From: | Wee Chua | Date: | Wed, 02 Aug 2000 14:52:28 +0000 |
| Subject: | RE: Error? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9708@lists.php.net to get a copy of this message | ||
Hi,
I have changed the $dbname to mydb but it is still not right and gave me the
same error message "Unknown database 'Resource id #1'", why? Please help,
thanks!
Calvin
-----Original Message-----
From: Craig Vincent [mailto:webmaster@jazzmonkey.com]
Sent: Wednesday, August 02, 2000 10:17 AM
To: chua@mail.interclean.com; mysql@lists.mysql.com
Subject: RE: Error?
> But I have an error for "Unknown database 'Resource id #1'".
<snip>
$username="php"; $password="good";
$db = mysql_connect("localhost", "$username", "$password");
mysql_select_db("$dbname", $db) or die (mysql_error());
$result = mysql_db_query($db, "INSERT INTO
user_profile(id,name,password,address_line1,address_line2,city,state,country
)
VALUES('','$name','$password','$address_line1','$address_line2','$city','$st
ate','$country')");
</snip>
My first reaction would be the fact...that if you posted your ENTIRE
code...you never specified a value for $dbname ....which means you're trying
to change to a NULL database which would be the cause of that error :) Try
giving $dbname a value or if you're only going to be using one database for
this, take out $dbname and replace it with the name of the database
containing the user_profile table.
Sincerely,
Craig Vincent
-------------------------
Senior Programmer
Jazzmonkey Media Inc.
http://www.jazzmonkey.com
-------------------------