Can't get this right
| From: | John Taylor-Johnston | Date: | Tue, 03 Dec 2002 05:13:25 +0000 |
| Subject: | Can't get this right | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-126810@lists.php.net to get a copy of this message | ||
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