hifigrafix — 2011-03-22T11:00:28-04:00 — #1
I've got a very simple table:
CREATE TABLE `active_songs` (
`id` int(11) NOT NULL auto_increment,
`song_title` varchar(255) default NULL,
`artist_name` varchar(255) default NULL,
`label` varchar(255) default NULL,
`hide_from_chart` varchar(255) default NULL,
`created` datetime default NULL,
`created_week` int(11) default NULL,
`user_added` tinyint(4) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
And when I run a simple SELECT on it with an ORDER BY directive it doesn't order by the field I specify. It is only ordering by the ID field.
SELECT * FROM active_songs WHERE hide_from_chart != '1' ORDER BY 'song_title' ASC
The query above should output the song list and order them by song title (obviously) but it's outputting them by ID no matter what. No errors are being thrown.
guido2004 — 2011-03-22T11:03:21-04:00 — #2
It's not that obvious... if you put song_title between quotes
hifigrafix — 2011-03-22T11:08:55-04:00 — #3
Oh.. nice.. so - this started happening right after I migrated this script to a new server.. those were originally "tildes" (the key under left hand esc). I wonder what would cause them to be transformed to single quotes / apostrophes.
thanks for the heads up.
r937 — 2011-03-22T11:22:29-04:00 — #4
i'm betting they were actually "backticks" (the key under left hand esc)
~ = tilde
` = backtick
and they "transformed to single quotes" when somebody typed them in wrong
guido2004 — 2011-03-22T11:37:58-04:00 — #5
Not necessarily. It once happened to me when I copy&pasted a query. I don't remember where I pasted it (something like Notepad, or directly in a webbased file management editing window) but when I saved it and ran the script, the backticks had become simple quotes... :shifty:
r937 — 2011-03-22T11:50:53-04:00 — #6
i'll bet it was microsoft word, lol
guido2004 — 2011-03-22T11:54:02-04:00 — #7