mysql_fetch_array and extract() with LEFT SELECT
| From: | Baumgartner Jeffrey | Date: | Wed, 19 Feb 2003 10:56:29 +0000 |
| Subject: | mysql_fetch_array and extract() with LEFT SELECT | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25757@lists.php.net to get a copy of this message | ||
I'm having a problem when I use mysql_fetch_array and extract() following a
left select query. As an example...
$query = "SELECT id,LEFT(fluff,80) FROM sometable";
$result = mysql_query($query) or die('message');
while ($row = mysql_fetch_array($result){
extract($row);
echo "<P>" . $id . ": " . $fluff . "</P>";
}
would echo the $id, but there would be nothing for $fluff. However, if I
select only 'fluff' from the MySQL table, I get the full text for $fluff. I
am reluctant to SELECT the entire fluff text from the table and shorten it
in PHP as that seems inefficient to me - (but correct me if I am wrong).
I expect the solution must be dead easy, but I can't find it or figure it
out.
Many thanks,
Jeffrey