It’s probably a stupid mistake on my side, I know.
I was trying to add a suffix to all post titles and a specific tag to all my posts in my blog (blog is a custom coded project for learning purposes). Once that wasn’t working, I tried to update it manually using phpMyAdmin, but with no success.
So, why is this not working:
UPDATE
posts
SET
title = 'myNewTitle',
tags = 'myStupidTag'
WHERE
id = 1
All I’m getting is OK status from mysql, but with 0 rows affected. However, if I use same ID in WHERE clause in a SELECT, I get post data just fine.
Is smt wrong with my query?
And here is the table:
CREATE TABLE IF NOT EXISTS `posts` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(512) DEFAULT NULL,
`link` varchar(512) DEFAULT NULL,
`rating` tinyint(3) unsigned DEFAULT NULL,
`html` text,
`tags` varchar(512) DEFAULT NULL,
`description` varchar(512) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=80 ;
Are you really sure that PHPMyAdmin says OK to your
UPDATEquery although there are no rows affected?Your
WHEREclause is wrong – theIDfield has to be uppercase – not lowercase!Try instead:
kind regards
EDIT:
wrong – user ajreal already corrected me!
But: your query must work – I tried it with your table scheme and some random generated data…