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