Re: mysql_fetch_array and extract() with LEFT SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try "SELECT id,LEFT(fluff,80) as fluffy FROM sometable"

Then extract() will have a value for fluffy


--- Baumgartner Jeffrey <j.baumgartner@itp-europe.com> wrote:
> 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
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
***************************************

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux