I created a MySQL database in Workbench 5.2.35 for purposes of storing and using information submitted in html forms but I'm having difficulty inserting records from the html form.
The relevant SQL script was saved as Demo2.sql, the schema is C2F, and the table is customer_info. I wasn't sure if that was the problem, so I tried replacing the database name (Demo2) with the schema name, but that didn't work either.
My html file includes:
form action="insert.php" method="post"
The insert.php file states:
?php $con = mysql_connect("localhost","root","****"); if (!$con) {
die('Could not connect: ' . mysql_error()); }
mysql_select_db("Demo2", $con);
$sql="INSERT INTO customer_info(fname, lname, user, password,
reminder, answer) VALUES
('$_POST[fname]','$_POST[lname]','$_POST[user]','$_POST[password]','$_POST[reminder]','$_POST[answer]')";
if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
echo "1 record added";
mysql_close($con) ?
I've also tried INSERT INTO c2f.customer_info(fname, lname, etc. and INSERT INTO 'c2f'.'customer_info'