update statement has no effect

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

update statement has no effect

Post by davidklonski »

Hi

I have the following table:

CREATE TABLE image_info (
Image_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
Title VARCHAR(255) NOT NULL,
Place VARCHAR(255) NOT NULL,
Date VARCHAR(255) NOT NULL,
Description VARCHAR(255) NOT NULL,
Submitter INT UNSIGNED NOT NULL,
Submission_Date DATE default '0000-00-00',
PRIMARY KEY (Image_ID),
FOREIGN KEY Submitter_fk (Submitter) REFERENCES people(AccountID)
) ENGINE=MYISAM DEFAULT CHARSET=latin1;

Just for clarity:
* Date: The date the photo was taken (it may be a free text, so it needs to be a VARCHAR(255) and not a Date
* Submission_Date: The date the photo was uploaded

The table is populated using:
LOAD DATA INFILE 'ImageInfo.sql' INTO TABLE image_info;

After the table is populated, I try to perform the following update statement:
UPDATE image_info SET Date = '2004-05-30', Submitter = 1, Submission_Date = CURDATE() WHERE Image_ID = 1041;

It is seems like the statement has no effect because the appropriate row isn't changed.
What could be the problem?

Thanks
sanyuan
Forum Newbie
Posts: 10
Joined: Sat Nov 22, 2003 8:55 pm
Location: australia

Post by sanyuan »

Keep single quotes around all values :

UPDATE image_info SET Date = '2004-05-30', Submitter = '1', Submission_Date = CURDATE() WHERE Image_ID = '1041'
Post Reply