What am I supposed to be doing with my slashes, exactly? Here is my first post:

http://news.php.net/article.php?group=php.general&article=126754

I can't get this right. I know I have to esacpe my quotes for my SQL to work.

http://news.php.net/article.php?group=php.general&article=126755

PHP addes the slashes all by itself, right? So here is my code:

$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';

http://ccl.flsh.usherb.ca/print/index.html

echo $sql; gives me this. This is what I thought I needed, but it doesn't work either.

SELECT id,AU,ST,BT,AT FROM ccl_main 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

If I copy & paste, it will work as a SQL in PHPMyAdmin. But it won't in PHP.

Can someone point at what I've done wrong? I've tried addslashes($search).

?? John

Reply via email to