[PHP] PHP Problem or MySQL (Match ... against)?
I'm stuck. I have been to the MySQL lists for this. Now I'm reconsidering my PHP code. http://ccl.flsh.usherb.ca/print/display.table.inc.phps I just don't know where I'm going wrong anymore. If I run this SQL in PHPMyAdmin, it works. jdaxell.ccl should have one entry for ready maria. SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B So what have I done wrong now :( John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Problem or MySQL (Match ... against)?
On Mon, 2 Dec 2002, jtjohnston wrote: SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. Escape the double quotes.('\ready maria\' IN BOOLEAN g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Problem or MySQL (Match ... against)?
Chris, or anyone, I have tried to escape the slashes. Debugging ... $sql = 'SELECT ... ... AGAINST (\'ready maria\' IN BOOLEAN MODE) ...'; This works. But if I addslashes or stripslashes, or do nothing, it does not work. See these 3 variations. Neither work. What should I do? A part from hang myself :) $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.addslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.$search.'\' IN BOOLEAN MODE) ORDER BY id asc'; John SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. Escape the double quotes.('\ready maria\' IN BOOLEAN g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php