php-db | 2001041
Date: 04/11/01
- Next message: Steve Farmer: "Re: [PHP-DB] date_format for Oracle"
- Previous message: Mike Baerwolf: "[PHP-DB] select substring_index"
- In reply to: Mike Baerwolf: "[PHP-DB] select substring_index"
- Next in thread: Matt Coyne: "[PHP-DB] Newbie : URGENT : SELECT ... AS"
- Reply: Matt Coyne: "[PHP-DB] Newbie : URGENT : SELECT ... AS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 4/11/01 7:48 PM, Mike Baerwolf at mike <email protected> 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/
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Steve Farmer: "Re: [PHP-DB] date_format for Oracle"
- Previous message: Mike Baerwolf: "[PHP-DB] select substring_index"
- In reply to: Mike Baerwolf: "[PHP-DB] select substring_index"
- Next in thread: Matt Coyne: "[PHP-DB] Newbie : URGENT : SELECT ... AS"
- Reply: Matt Coyne: "[PHP-DB] Newbie : URGENT : SELECT ... AS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

