Bill Karwin wrote:
>
>
>
>
> Array ( [10] => Product 1
> [30] => Product 2
> [40] => Product 3
> [60] => Product 4
> [80] => Product 5
> [88] => Product 6
> [90] => Product 7
> [100] => Product 8
> ... and so on
>
>
> There is a method of Zend_Db_Adapter that returns results in this format.
> You should be able to use the Select object as the query
>
> $products = new ProductTest();
> $select = $products->select();
> $select -> from($products,array("pruductid","productname"))
> -> where("prodtype='10'")
> -> where('timestamp=?',"$zmtimestamp")
> -> order("prodname");
>
> Here's the usage of the adapter method. It returns an simple PHP
> associative array, not a Zend_Db_Table_Rowset object, so there is no need
> to use toArray().
>
> $result2Array = $products->getAdapter()->fetchPairs($select);
>
> See also
> http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.select.fetchpairs
>
> Regards,
> Bill Karwin
>
>
Quoted from:
http://www.nabble.com/How-i-can-fetch-array-only-with-desired-data--tp17780211p17784524.html
thank you very much :)
I have just one question more.
how can i do this when i have more data?
$products = new ProductTest();
$select = $products->select();
$select ->
from($products,array("pruductid","productname","productcompany","year"))
-> where("prodtype='10'")
-> where('timestamp=?',"$zmtimestamp")
-> order("prodname");
and i want to get
Array ( [10] => Product 1 - Company1 - 2005
[30] => Product 2 - Company2 - 2008
[40] => Product 3 - Company1 - 2004
.....
--
View this message in context:
http://www.nabble.com/How-i-can-fetch-array-only-with-desired-data--tp17780211p17793586.html
Sent from the Zend Framework mailing list archive at Nabble.com.