Skip navigation links

MySQL Forums :: PHP :: MySQL 5.5.24 - error in your SQL syntax


Advanced Search

MySQL 5.5.24 - error in your SQL syntax
Posted by: Nono Seki ()
Date: January 19, 2013 09:31AM

Hi,
I'm having a problem with my PHP / MySQL request.

Here is the content I send from a form :

sites_admins_id = 4
from :
<input type="hidden" name="sites_admins_id" value="<?php echo $siteslisting[$var3]['id']; ?>"/>

user_group = partner
from :
<select name="user_group" id="user_group">
<option value="agency">agency</option>
<option value="partner">partner</option>
<option value="manager">manager</option>
<option value="employee">employee</option>
</select>


Here is the PHP script that sends the request :

$insertSQL = sprintf("UPDATE sites_admins SET group=%s WHERE id=%s",
GetSQLValueString($_POST['user_group'], "text"),
GetSQLValueString($_POST['sites_admins_id'], "int"));
$Query1 = mysql_query($insertSQL,$user) or die(mysql_error());


Here is the answer from MySQL

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 'group=partner WHERE id=4' at line 1


I exported the table to show you what it looks like :

CREATE TABLE IF NOT EXISTS `sites_admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_admin` int(11) NOT NULL,
`id_site` int(11) NOT NULL,
`group` varchar(8) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;


I don't understand because I usually don't have any problem with this kind of requests, can somebody help ?
Thanks !



Edited 2 time(s). Last edit at 01/19/2013 09:37AM by Nono Seki.

Options: ReplyQuote


Subject Written By Posted
MySQL 5.5.24 - error in your SQL syntax Nono Seki 01/19/2013 09:31AM
Re: MySQL 5.5.24 - error in your SQL syntax Peter Brawley 01/19/2013 11:15AM
Re: MySQL 5.5.24 - error in your SQL syntax nono seki 01/21/2013 07:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.