carlg Posted February 14, 2008 Share Posted February 14, 2008 $name=$_POST['name']; $q=$db->query("SELECT * FROM ships_types WHERE shipid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("UPDATE ships_types SET '{$_POST['name']}', '{$_POST['desc']}','{$_POST['shipCOST']}','{$_POST['shipACC']}','{$_POST['shipHAN']}','{$_POST['shipsPD']}','{$_POST['shipsHD']}','{$_POST['shipBUYABLE']}"); this is the error i get QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''carl41','addinge','11','11','11','11','1','1' at line 1 Query was UPDATE ships_types SET 'carl41','addinge','11','11','11','11','1','1 Quote Link to comment Share on other sites More sharing options...
Ghetto Posted February 14, 2008 Share Posted February 14, 2008 Re: 1 more thing with a query $name=$_POST['name']; $q=$db->query("SELECT * FROM ships_types WHERE shipid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("UPDATE ships_types SET '{$_POST['name']}', '{$_POST['desc']}','{$_POST['shipCOST']}','{$_POST['shipACC']}','{$_POST['shipHAN']}','{$_POST['shipsPD']}','{$_POST['shipsHD']}','{$_POST['shipBUYABLE']}'"); Try that. Quote Link to comment Share on other sites More sharing options...
carlg Posted February 14, 2008 Author Share Posted February 14, 2008 Re: 1 more thing with a query no i am still getting QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''carl41', 'addinge','11','11','11','11','11','1'' at line 1 Query was UPDATE ships_types SET 'carl41', 'addinge','11','11','11','11','11','1' i have been up all night trying to debug this but i have no ider Quote Link to comment Share on other sites More sharing options...
Ghetto Posted February 14, 2008 Share Posted February 14, 2008 Re: 1 more thing with a query If your inserting a new 'Ship Type' into the table it would be somthing like this. $name=$_POST['name']; $q=$db->query("SELECT * FROM ships_types WHERE shipid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("INSERT INTO ships_types VALUES('', '{$_POST['name']}', '{$_POST['desc']}','{$_POST['shipCOST']}','{$_POST['shipACC']}','{$_POST['shipHAN']}','{$_POST['shipsPD']}','{$_POST['shipsHD']}','{$_POST['shipBUYABLE']}')"); If you editing a 'Ship Type' you would hav to do something like this. $name=$_POST['name']; $q=$db->query("SELECT * FROM ships_types WHERE shipid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("UPDATE ships_types SET SHIPNAME='{$_POST['name']}', SHIPDECRIPTION='{$_POST['desc']}', SHIPCOST='{$_POST['shipCOST']}', and so on... You would need to replace the SHIPNAME, SHIPDECRIPTION, SHIPCOST and all that with the names in the database.. for example for crimes it would be: crimeNAME='{$_POST['crimeNAME']}', crimePERCFORM='{$_POST['crimePERCFORM']}', ECT. 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.