redgunner Posted August 24, 2010 Share Posted August 24, 2010 I am having difficulties in resolving this issue... Deprecated: mysql_db_query() [function.mysql-db-query]: This function is deprecated; use mysql_query() instead I do what it asks and then I get the following error message... ERROR: INSERT INTO customers (name, age) VALUES ('', 'Joe' '40') Added Show Records if ($_SERVER['REQUEST_METHOD'] == "POST") { // Form Values $id = ""; $name = $_POST['name']; $age = $_POST['age']; $SQL = " INSERT INTO customers "; $SQL = $SQL . " (name, age) VALUES "; $SQL = $SQL . " ('$id', '$name' '$age') "; $result = mysql_db_query($database,"$SQL"); if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } echo ("Added\n"); } Thanks for any help in advance... Quote Link to comment Share on other sites More sharing options...
Alex Posted August 24, 2010 Share Posted August 24, 2010 1. You're still using mysql_db_query() there. 2. You're naming only 2 columns and providing 3 values. Quote Link to comment Share on other sites More sharing options...
RussellReal Posted August 24, 2010 Share Posted August 24, 2010 if id is an auto incrementing field you don't need to show it.. and like the other poster said you're still using mysql_db_query Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2010 Share Posted August 24, 2010 And the two values you do want to put into the query don't have a comma in between them. Quote Link to comment 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.