I would like to get the same result on two different manners. 

1. First way is working correct:

$db = OCIlogon('testd','testg','www.....');
$statement = "SELECT pruductid, productname FROM producttable WHERE prodtype
= 10 and timestamp = '20080606' ORDER BY prodname";
$stmt = ociparse($db, $statement);
ociexecute($stmt);

while (ocifetch($stmt)) { 
  $result[ociresult($stmt,1)] = ociresult($stmt,2);
}

print_r($result);

if i print this data, i get:
                
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
This is OK.
       

2. Another way is written like this(with config.ini and class ProductTest):
       
$products = new ProductTest();
$select = $products->select();
$select -> from($products,array("pruductid","productname")) 
        -> where("prodtype='10'")
                                -> where('timestamp=?',"$zmtimestamp")
                                -> order("prodname");

$result2 = $products->fetchAll($select);
$result2Array = $result2->toArray();        

print_r($result2Array);

And I get:

Array ( 
    [0] => Array ( [pruductid] => 10 [productname] => Product 1 ) 
    [1] => Array ( [pruductid] => 30 [productname] => Product 2 ) 
    [2] => Array ( [pruductid] => 40 [productname] => Product 3 ) 
    [3] => Array ( [pruductid] => 60 [productname] => Product 4 ) 
    [4] => Array ( [pruductid] => 80 [productname] => Product 5 ) 
    [5] => Array ( [pruductid] => 88 [productname] => Product 6 ) 
    [6] => Array ( [pruductid] => 90 [productname] => Product 7 ) 
    ....
    
But i wish to get the same result like on the first way. How can i do that?
I dont know :( Please help
-- 
View this message in context: 
http://www.nabble.com/How-i-can-fetch-array-only-with-desired-data--tp17780211p17780211.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to