----- Original Message ----- From: "Addison Ellis" <addison@bellsouth.net> To: <php-db@lists.php.net> Sent: Tuesday, January 28, 2003 10:46 PM Subject: sql syntax error > hello, > i can not pinpoint this. your time and help is very much > appreciated. best, addison > > Error: > id=, HTTP_POST_VARS=Array, key=, value=, category=, subcategory=, > logname=addison@bellsouth.net > Error in query: insert into ads values > (year,make,model,color,mileage,condition,price,other,contact,next_,,created) > values ('',,NOW()),Error:You have an error in your SQL syntax near > 'created) values ('',,NOW())' at line 1 > > Code: > else > { > foreach($HTTP_POST_VARS as $column_name => $column_value) > > $column_names .= $column_name . ','; > $column_values .= "'$column_values',"; > > $query = "insert into ads values ($column_names,created) > values ($column_values,NOW())"; > $result = mysql_query($query) > or die ("Error in query: $query,Error:" .mysql_error()); > } Try this: foreach($HTTP_POST_VARS as $column_name => $column_value) { $column_names .= $column_name . ','; $column_values .= "'$column_value',"; } $query = "insert into ads values ($column_names created) values ($column_values NOW())"; $result = mysql_query($query) or die ("Error in query: $query,Error:" .mysql_error()); I still don't think it's going to work for you. do you really have a column called 'next_' in your table? It's probably the button you pressed to submit the form, which is in HTTP_POST_VARS, but I don't see a reason it would be in your table... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php