Re: Whimper, help :)
| From: | Tom Rogers | Date: | Wed, 04 Dec 2002 04:25:24 +0000 |
| Subject: | Re: Whimper, help :) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126936@lists.php.net to get a copy of this message | ||
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
JTJ> problem. It's my PHP syntax.
JTJ> Debugging:
JTJ>
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
JTJ> received:
JTJ> +ready +maria
JTJ> not
JTJ> "ready maria"
JTJ> See:
JTJ> 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 ...
JTJ> 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