squarkman
Technical User
- Mar 10, 2008
- 34
Hi Gurus,
I have a php opt-in system works perfectly. Next, I simply removed the one line that mailed the information to my email address and replaced it with the code below to get one step closer to adding data to my database thru the system after confirmation. I get an error. The only thing that could be wrong is in the code below. The name of the database is correct, the username and password are correct and I guess 'localhost' works since the error I get is "cannot select db".
-----------------------
$host="localhost";
$username="xxxxxx";
$password="xxxxxx";
$db_name="xxxxxxxxx";
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name")or die("cannot select db");
mysql_query("INSERT INTO customer (name, sex)VALUES ('Robert','male')");
mysql_query("INSERT INTO customer (name, sex)VALUES ('Sally','Female')");
mysql_close($con);
I have a php opt-in system works perfectly. Next, I simply removed the one line that mailed the information to my email address and replaced it with the code below to get one step closer to adding data to my database thru the system after confirmation. I get an error. The only thing that could be wrong is in the code below. The name of the database is correct, the username and password are correct and I guess 'localhost' works since the error I get is "cannot select db".
-----------------------
$host="localhost";
$username="xxxxxx";
$password="xxxxxx";
$db_name="xxxxxxxxx";
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name")or die("cannot select db");
mysql_query("INSERT INTO customer (name, sex)VALUES ('Robert','male')");
mysql_query("INSERT INTO customer (name, sex)VALUES ('Sally','Female')");
mysql_close($con);