Searching for a whole word
| From: | Francisco Javier Lozano Bastidas | Date: | Tue, 21 Nov 2000 07:35:24 +0000 |
| Subject: | Searching for a whole word | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4618@lists.php.net to get a copy of this message | ||
Hello ... I need to search in a MySQL table for a whole word. When I do it
from msyql prompt it's ok :
select * from table_name where column_name REGEXP '[[:<:]]word[[:>:]]'
When I do it from a php script :
$result = mysql_query("select * from table_name where column_name REGEXP
'[[:<:]]$pattern[[:>:]]'");
I get this error message on my browser :
Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING'
What can I do ? Tks!
By the way, I need a good way to do a like search engine with PHP/MySQL =)
~~~~~~~~~~~~~~~~
Francisco Javier