Jump to content

Error in UPDATE


bulrush

Recommended Posts

I'm just not seeing an error in this SQL statement. Can anyone help me please?

UPDATE group SET groupname='aaTest 2 group edited', SET basemodel='abh', SET classcode='', SET sin='', SET openmkt=0, SET updateuser='foo', SET updatedate=NOW() WHERE gid=28;

 

But php returns an error when I use this code:

if (!$result=mysqli_query($dbc,$query))

 

 

 

Link to comment
Share on other sites

Sorry. I modified some of the things. Here is the real SQL statement.

UPDATE hgroup SET groupname='aaTest 2 group edited', 
SET basemodel='abh', SET classcode='', SET sin='', SET openmkt=0, 
SET updateuser='chuckr', SET updatedate=NOW() WHERE grid=28;

I ran it through the phpMyAdmin sql processor, and it gave me an error, but everything looked ok. Here is the phpMyadmin sql error:

SQL query:

UPDATE hgroup SET groupname = 'aaTest 2 group edited',
SET basemodel = 'abh',
SET classcode = '',
SET sin = '',
SET openmkt =0,
SET updateuser = 'chuckr',
SET updatedate = NOW( ) WHERE grid =28

MySQL said: Documentation
#1064 - 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 
'SET basemodel='abh', SET classcode='', SET sin='', SET openmkt=0, 
SET updateuser' at line 1 

Oddly enough, all these fields work fine in an INSERT and SELECT statement. So it shouldn't be a problem with the field names, right?

 

Link to comment
Share on other sites

Here is my table layout.

CREATE TABLE `hgroup` (
  `grid` bigint(20) NOT NULL auto_increment,
  `createuser` varchar(15) NOT NULL default '',
  `createdate` datetime NOT NULL default '0000-00-00 00:00:00',
  `updateuser` varchar(15) default NULL,
  `updatedate` datetime default NULL,
  `groupname` varchar(80) NOT NULL default '',
  `image1` varchar(30) default NULL,
  `classcode` char(3) default NULL,
  `sin` varchar(30) default NULL,
  `openmkt` tinyint(1) NOT NULL default '0',
  `col1name` varchar(50) default NULL,
  `basemodel` varchar(50) default NULL,
  PRIMARY KEY  (`grid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ;

 

When I reduce my query down to this:


UPDATE hgroup SET groupname='aaTest 1 edited again', SET basemodel='AZA' WHERE grid=30;

I start getting errors. That means, the field 'basemodel' is giving me errors somehow.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.