Hi,

Wednesday, December 4, 2002, 2:06:36 PM, you wrote:
JTJ> Martin,
JTJ> Anyone,

JTJ> I'm desperate :( PHP isn't sending my SQL correctly. It's not a MySQL problem. 
It's my PHP syntax.

JTJ> Debugging:
JTJ> http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B

JTJ> $sql = 'SELECT ... FROM '.$table.' WHERE MATCH ... AGAINST
JTJ> (\'"ready maria"\' IN BOOLEAN MODE) ORDER BY id asc';

JTJ> Yay ... :) it works!!! (http://ccl.flsh.usherb.ca/print/display.test.inc.phps)

JTJ> If I copy & paste this SQL into PHPMyAdmin, it works.

JTJ> BUT IT WON'T WORK IN PHP. The code belows echos $sql correctly, but MySQL thinks 
it received:

JTJ> +ready +maria

JTJ> not

JTJ> "ready maria"

JTJ> See: 
http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B

JTJ>   $sql = 'SELECT ... FROM '.$table.' WHERE MATCH ... AGAINST
JTJ>   (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id
JTJ>   asc';

JTJ>   $sql = "SELECT ... FROM `$table` WHERE MATCH ... AGAINST
JTJ>   ('".stripslashes($search)."' IN BOOLEAN MODE) ORDER BY id
JTJ>   asc";

JTJ>   See (http://ccl.flsh.usherb.ca/print/display.table.inc.phps)

JTJ> What is the correct PHP syntax to get MySQl to read my SQl correctly?
JTJ> What am I f***ing up?

JTJ> John


If you are looking for " in a string just quote it with '

example
$like = '"ready maria"';
$ sql = " SELECT .......... WHERE .... LIKE '$like'";

no need to escape anything

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to