Re[2]: [PHP] OK SQL experts...
| From: | Tom Rogers | Date: | Fri, 23 Apr 2004 16:01:24 +0000 |
| Subject: | Re[2]: [PHP] OK SQL experts... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184421@lists.php.net to get a copy of this message | ||
Hi,
Saturday, April 24, 2004, 1:55:36 AM, you wrote:
JB> [snip]
JB> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
JB> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE
JB> '%$keyword%') AND
JB> 'status' = 'active';
JB> [/snip]
JB> *slaps forehead*
JB> "SELECT * FROM my_table WHERE (field_1 LIKE '%" . $keyword . "%' OR
JB> field_2 LIKE '%" . $keyword . "%' OR field_3 LIKE '%" .
JB> $keyword . "%')
JB> AND
JB> status = 'active'";
JB> The single quoted variables do not get parsed
JB> --
JB> PHP General Mailing List (http://www.php.net/)
JB> To unsubscribe, visit: http://www.php.net/unsub.php
They do if they are themselves inside double quotes :)
echo "'$var'"; will get parsed ok
--
regards,
Tom