William Curry wrote:
I have issues I cant understand passing a sql statement to mssql, most
of which work fine, however in some cases, a statement like
"SELECT * FROM tblX where value like 'variable%' " will return 0
records when I know they are there. No errors, just 0 records.
When I echo the sql string to the page, cut and paste it into SQL query
analyzer, the exact same statement returns the expected records.
Anyome point me to the answer??
It's over there ----->
Sorry, couldn't resist.
Anyhoo, are you expecting variable to be replaced with the contents of
$variable? If so that's never going to work. Try this instead...
"SELECT * FROM tblX where value like '".str_replace("'", "''",
$variable)."%' "
-Stut
--
http://stut.net/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php