expanding inside quotes problem
| From: | Andrew Threlfall | Date: | Mon, 06 Nov 2000 21:31:20 +0000 |
| Subject: | expanding inside quotes problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23983@lists.php.net to get a copy of this message | ||
I've a problem with the folowing line
$results = mysql_query("SELECT * FROM group WHERE postcode REGEXP
'^$query[:digit:]+.*'", $db)
when run I get:
"Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING' "
I think the problem is that php is treating the square brackets as a regular
expression, and attempting to expand it(?). I can stop this by using single
quotes, but then the variable in the string will not be expanded.
I'm not sure what to escape in order that the query get passed correctly.
I hope I've made it relatively clear.
Thanks
--
Andrew