RE: Howto search in SQL for a specific character?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux