php-db | 2001041
Date: 04/11/01
- Next message: Paul Burney: "Re: [PHP-DB] select substring_index"
- Previous message: Joe Brown: "Re: [PHP-DB] date_format for Oracle"
- Next in thread: Paul Burney: "Re: [PHP-DB] select substring_index"
- Reply: Paul Burney: "Re: [PHP-DB] select substring_index"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have a simple news manager and I would like to display the first two sentences of a news story. I got this select statement from the mysql mailing list:
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",$db) or die ("Invalid Query");
if ($myrow = mysql_fetch_array($result)) {
do {
printf("%s\n<br>", $myrow["headline"]);
printf("%s\n", $myrow["body"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
It dies a cold death. I looked at the mysqld.log and the above is not putting the . in the quotes. I'm stuck in the mud, don't really know if this is even possible. I would appreciate any pointers.
Thanks in advance,
Mike
- Next message: Paul Burney: "Re: [PHP-DB] select substring_index"
- Previous message: Joe Brown: "Re: [PHP-DB] date_format for Oracle"
- Next in thread: Paul Burney: "Re: [PHP-DB] select substring_index"
- Reply: Paul Burney: "Re: [PHP-DB] select substring_index"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

