Clinton Posted September 11, 2007 Share Posted September 11, 2007 All the variables are being passed correctly, the table name and columns are correct, no errors are being generated... but the information is not being inserted into my db. Any ideas? <? mysql_connect("localhost", "******", "********") or die(mysql_error()); mysql_select_db("anderse_inventory") or die(mysql_error()); mysql_query("INSERT INTO roster (Name, Title, CellPhone, HomePhone, Email, Notes, Position, Terminated) VALUES ('".$_POST['Name1']."', '".$_POST['Title1']."', '".$_POST['CellPhone1']."', '".$_POST['HomePhone1']."', '".$_POST['Email1']."', '".$_POST['Notes1']."', '".$_POST['Position1']."', '".$_POST['Terminated1']."')"); ?> <? echo $_POST['Name1']?> has been added to the database. <a href="keyper2.php">Return</a><br> <? echo $_POST['Title1']?><br> <? echo $_POST['CellPhone1']?><br> <? echo $_POST['HomePhone1']?><br> <? echo $_POST['Email1']?><br> <? echo $_POST['Notes1']?><br> <? echo $_POST['Position1']?><br> <? echo $_POST['Terminated1']?><br> Quote Link to comment https://forums.phpfreaks.com/topic/68849-solved-not-inserting-into-db/ Share on other sites More sharing options...
mac.php Posted September 11, 2007 Share Posted September 11, 2007 mysql_query("INSERT INTO roster (Name, Title, CellPhone, HomePhone, Email, Notes, Position, Terminated) VALUES ('".$_POST['Name1']."', '".$_POST['Title1']."', '".$_POST['CellPhone1']."', '".$_POST['HomePhone1']."', '".$_POST['Email1']."', '".$_POST['Notes1']."', '".$_POST['Position1']."', '".$_POST['Terminated1']."')"); change too: mysql_query("INSERT INTO roster (Name, Title, CellPhone, HomePhone, Email, Notes, Position, Terminated) VALUES ('".$_POST['Name1']."', '".$_POST['Title1']."', '".$_POST['CellPhone1']."', '".$_POST['HomePhone1']."', '".$_POST['Email1']."', '".$_POST['Notes1']."', '".$_POST['Position1']."', '".$_POST['Terminated1']."')")or die( mysql_error() ); and then see if any error is outputted... Quote Link to comment https://forums.phpfreaks.com/topic/68849-solved-not-inserting-into-db/#findComment-346057 Share on other sites More sharing options...
Clinton Posted September 11, 2007 Author Share Posted September 11, 2007 Thank you. The error showed what it was and I was able to fix it (I keep forgetting that Terminated is a reserved word and I should probably change that.) Quote Link to comment https://forums.phpfreaks.com/topic/68849-solved-not-inserting-into-db/#findComment-346062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.