Re: Howto search in SQL for a specific character?
| From: | Gustav Wiberg | Date: | Tue, 29 Nov 2005 21:11:22 +0000 |
| Subject: | Re: Howto search in SQL for a specific character? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226602@lists.php.net to get a copy of this message | ||
Hi there!
This didn't work. Ok, mysql 4.x don't have support for the command. Exuse my.. didn't realize that before... I have to do this another way around... :-)
/G
----- Original Message ----- From: "Jay Blanchard" <jay.blanchard@THERMON.com>
To: "'Gustav Wiberg'" <gustav@varupiraten.se>; "PHP General" <php-general@lists.php.net>
Sent: Tuesday, November 29, 2005 9:59 PM
Subject: RE: [PHP] Howto search in SQL for a specific character?
[snip] $v1 = chr(39); //39 is apostrofe $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = $v1"; Why doesn't this work? [/snip] Probably because the character set is misinterpreted. What happens when you echo $v1? Try $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = ''' "; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php