Get rid of last comma after conpass: "INSERT INTO users (email, password, conpass,) VALUES
('$_POST[email]','$_POST[password]','$_POST[confirmPassword]')";
If this is an all or nothing proposition, I would recommend using Transactions assuming the database your working with supports it.
Last edited by JavaServlet; 06-22-2009 at 05:46 PM.
"INSERT INTO users (email, password, conpass) VALUES
('$_POST[email]','$_POST[password]','$_POST[confirmPassword]')";
any ide why?
I assume you have a reason for first statement in a variable and the second one is not. Do you have any error messages after you execute the PHP script? Next step is to test the SQL in the database with test values and see if it works and go from there. For example if using Oracle you can test the statements in SQL Plus.
Hi, no error massages. if i would put the user table first then i manage to insert into that table but not the flats table. It will only insert into one table
"I assume you have a reason for first statement in a variable and the second one is not".
I dont know what you meen by this. and i inserted manuanly into the database and its inserting data fine.
any other way to insert data into two tables using one html form??
If your using php to execute the command then you have to separate the statements. I believe the mysql_query command in PHP can only execute one statement at a time. Just call mysql_query twice.
Bookmarks