> $query = "INSERT INTO $lcstage (id, ".$fieldNames.") VALUES > (".$clientID.",".$values.")"; > > The finishing querystring, if printed lookks like this: [snip] Have you actually tested the output of each variable? If $clientID and $values are equivalents of $_POST['clientID'] and $_POST['values'], it's no surprise that things don't work as expected. Those variables are arrays, not strings. You need to use implode on both to get the strings needed by the script above. Edward Dudlik Becoming Digital www.becomingdigital.com Did I help you? Want to show your thanks? www.amazon.com/o/registry/EGDXEBBWTYUU ----- Original Message ----- From: "Jamie Saunders" <phpdev@mediacdcards.net> To: <php-db@lists.php.net> Sent: Monday, 23 June, 2003 05:17 Subject: strange query problem Hi, I'm having a problem with a database query, where the script is simply inserting some data into an empty table. The following code creates the query string to be used, the values are all gathered from an html form: $query = "INSERT INTO $lcstage (id, ".$fieldNames.") VALUES (".$clientID.",".$values.")"; The finishing querystring, if printed lookks like this: INSERT INTO myfamily (id, fathers, mothers, brothers, sisters, grandfathers, grandmothers, ggrandfathers, ggrandmothers, aunts, uncles, godparents) VALUES (36,'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1') However, I get a database error every time informing me the query could not be performed. To test the query I've pasted the printed query string into phpMyAdmin and it works first time every time. So if there's nothing wrong with the query string or the database, what else could be causing this error? -- Jamie Saunders Media Architect phpdev@mediacdcards.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php