Error?
| From: | Wee Chua | Date: | Wed, 02 Aug 2000 13:14:33 +0000 |
| Subject: | Error? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9682@lists.php.net to get a copy of this message | ||
I try to create a form which allows new user to enter their basic
information.
But I have an error for "Unknown database 'Resource id #1'". Could you guys
please take a look on my simple codes and tell where the error is? Thanks.
Calvin
--Register.php--
<html>
<HEAD>
<TITLE>Register</TITLE>
</HEAD>
<H1>Please enter to register:</H1>
<BODY BGCOLOR="#9ac5ff">
<FORM ACTION="Reply.php" METHOD="POST">
Database Name:<SELECT NAME="dbname">
<Option Value="mydb">MyDB</option>
</SELECT><br>
Name: <INPUT TYPE="TEXT" NAME="name" MAXLENGTH="20"> <BR>
Password: <INPUT TYPE="TEXT" NAME="password"
MAXLENGTH="20"><BR>
Address 1: <INPUT TYPE="TEXT" NAME="address_line1"
MAXLENGTH="40"><BR>
Address 2: <INPUT TYPE="TEXT" NAME="address_line2"
SIZE="40"><BR>
City: <INPUT TYPE="TEXT" NAME="city" MAXLENGTH="20"><BR>
State: <INPUT TYPE="TEXT" NAME="state" MAXLENGTH="2"><BR>
Country: <INPUT TYPE="TEXT" NAME="country"
MAXLENGTH="20"><BR>
<INPUT TYPE="RESET" NAME="reset" VALUE="Reset">
<INPUT TYPE="SUBMIT"
NAME="submit" VALUE="Submit">
</FORM>
</BODY>
</html>
--Reply.php--
<html>
<BODY BGCOLOR="#9ac5ff">
<?php
$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')");
echo ("Thanks for your time!");
?>
</body>
</html>