Jump to content
MakeWebGames

Recommended Posts

Posted
$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

Posted

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.

Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...