| Re: select a single quote from MySQL ? |
| by Dave_L on 2006/11/13 16:43:58 Quote: Strange how you can just stare at stuff at not see the anwser. True. I've spent hours staring at an obvious error without seeing it.
|
| Re: select a single quote from MySQL ? |
| by highlander on 2006/11/13 16:33:52 Hello Dave_L, 1) Thats just me trying to make an example which makes more sences than my actual data. Figures I'd get that bit wrong !! 2) Works well for me to !! Thanx a bunch. Strange how you can just stare at stuff and not see the anwser. I'd tried every variation of escaping characters exept the right one. Makes perfect sense now. Kind regards, Highlander (in an escaping mood) p.s. strange though that phpmyadmin creates an incorrect query when using the Search mode and a LIKE query instead of a = query. le="color: #000000"><?php SELECT * FROM `tablename` WHERE `NAME` LIKE CONVERT( _utf8 'name with \'' a single quote' USING latin1 ) COLLATE latin1_swedish_ci LIMIT 0 , 30
|
| Re: select a single quote from MySQL ? |
| by Dave_L on 2006/11/13 16:12:38 1) I asked this question because in the queries you have "A name..." but then you say that the actual data is "name...". Obviously those don't match. 2) If the actual column value is 'name with \' a single quote', then this query should work: SELECT * FROM `tablename` WHERE `NAME` = 'name with \\\' a single quote'; Note that the \ is escaped as \\, and the ' is escaped as \'. I tested it with phpMyAdmin, and it works for me. |
| Re: select a single quote from MySQL ? |
| by highlander on 2006/11/13 15:51:42 1) the data is completely fictious. 2) the column value contains \' I agree with you on the not using quotes, they can be nasty. However I have always been able to solve stuff, but can't seem to get this one done...grr Highlander |
| Re: select a single quote from MySQL ? |
| by Dave_L on 2006/11/13 15:21:55 Quote: The string stored in the database is simply the following : 1) Does the column value start with "name" or "A name"? 2) Does the column value contain ' or \' ? Personally I waste a lot of time solving quotes-related problems, and wish they would go away. To everyone who reads this: Stop using quotes. Never use them again.
|