almightyegg Posted August 8, 2007 Share Posted August 8, 2007 $update = mysql_query("UPDATE ranks (`name`, `color`, `mod`, `invite`, `ban`, `give`, `edit`, `kick`, `changerank`, `editrank`) VALUES('$name', '$color', '$mod', '$invite', '$ban', '$give', '$edit', '$kick', '$changerank', '$editrank') WHERE society='$id' AND rank='$rank'") or die(mysql_error()); it errors: 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 '(`name`, `color`, `mod`, `invite`, `ban`, `give`, `edit`, `kick`, `changerank`, ' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/ Share on other sites More sharing options...
frost Posted August 8, 2007 Share Posted August 8, 2007 try adding a single quote around ranks? $update = mysql_query("UPDATE `ranks` Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318717 Share on other sites More sharing options...
almightyegg Posted August 8, 2007 Author Share Posted August 8, 2007 no change Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318719 Share on other sites More sharing options...
frost Posted August 8, 2007 Share Posted August 8, 2007 Here is a bit of code I wrote that I know works, it looks like what you have here is for INSERT? $sql = "UPDATE `categories` SET category='$category',intro='$intro' WHERE id = '$theid'"; $result = mysql_query($sql); I think you need the SET command? Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318724 Share on other sites More sharing options...
almightyegg Posted August 8, 2007 Author Share Posted August 8, 2007 I still get the error $update = mysql_query("UPDATE ranks SET name='$name',color='$color',mod='$mod',invite='$invite',ban='$ban',give='$give,edit='$edit,kick='$kick',changerank='$changerank',editrank='$editrank' WHERE society='$id' and rank='$rank'") or die(mysql_error()); Maybe it's because of my WHERE queries? As I have 2 of them...? Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318734 Share on other sites More sharing options...
almightyegg Posted August 8, 2007 Author Share Posted August 8, 2007 $update = mysql_query("UPDATE ranks SET name='{$name}',color='{$color}',mod='{$mod}',invite='{$invite}',ban='{$ban}',give='{$give}',edit='{$edit}',kick='{$kick}',changerank='{$changerank}',editrank='{$editrank}' WHERE society='{$id}',rank='{$rank}'") or die(mysql_error()); This is where I'm at now, still get this: 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 'mod='Yes',invite='No',ban='Yes',give='Yes',edit='No',kick='22',changerank='0',ed' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318818 Share on other sites More sharing options...
almightyegg Posted August 8, 2007 Author Share Posted August 8, 2007 I managed to fix it, it seemed it was recognising the column name as something else Quote Link to comment https://forums.phpfreaks.com/topic/63940-solved-more-update-problems/#findComment-318852 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.