tapius1 Posted July 21, 2009 Share Posted July 21, 2009 I need some help figuring out what's wrong with my query .....//create new db object that connects to the db $db = new DB2(); if(!$db->connect("DB2CONN", "user","*******")) { print "Error\n"; header("location:ERROR.htm"); } //insert statement to repleace account information with updated information, make sure all fields are filled in, //if possible use _GET and put in the values into the boxes before the user makes any changes $sql .="INSERT INTO KCWEB (ADDR1, ADDR2, CITY, STATE, ZIP, PHONE1, PHONE2, SSN_NUM) VALUES ($address1, $address2, $city, $state, $zip, $phone1, $phone2, $ssn_num) WHERE CTRL_NUM = $ctrl_num"; $db->query($sql); echo "Account Information Updated"; ?> it returns : Error: [unixODBC][iBM][iSeries Access ODBC Driver][DB2 UDB]SQL0104 - Token , was not valid. Valid tokens: ( + - ? : DAY RRN CASE CAST CHAR DATE DAYS HASH HOUR LEFT NULL. SQL: INSERT INTO KCWEB (ADDR1, ADDR2, CITY, STATE, ZIP, PHONE1, PHONE2, SSN_NUM) VALUES (, , , , , , , 3333) WHERE CTRL_NUM = 3333333333 any help would be great thanks Quote Link to comment https://forums.phpfreaks.com/topic/166829-insertion-query-giving-problems/ Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 -by the looks of it, your variables aren't set to anything...where is the code that sets them? -INSERT statements don't have WHERE clauses -anything that isn't an integer needs single quotes around it Quote Link to comment https://forums.phpfreaks.com/topic/166829-insertion-query-giving-problems/#findComment-879711 Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 also, not sure where your DB2 class came from, but you should take advantage of Prepared statements in DB2. that way all the data gets escaped properly. there is an example here: http://us3.php.net/manual/en/function.db2-execute.php Quote Link to comment https://forums.phpfreaks.com/topic/166829-insertion-query-giving-problems/#findComment-879713 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.