Re: select substring_index
| From: | Paul Burney | Date: | Thu, 12 Apr 2001 02:07:02 +0000 |
| Subject: | Re: select substring_index | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8509@lists.php.net to get a copy of this message | ||
on 4/11/01 7:48 PM, Mike Baerwolf at mike@wkla.com wrote:
> SELECT substring_index( body, ". ", 2) FROM news;
>
> This works great from the mysql client but when I try it using php with
> this:
>
> $result = mysql_query("SELECT substring_index(body, "." ,2) FROM news"
The way you have this written, PHP is using the . for concatenation. To fix
the problem you need to alternate or escape the quotes, i.e. :
$result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM news"
or
$result = mysql_query('SELECT substring_index(body, "." ,2) FROM news'
or
$result = mysql_query("SELECT substring_index(body, '.' ,2) FROM news"
Hope that helps,
Paul Burney
http://paulburney.com/