How can I convert record set from database to array?
It has 1 table named: tblproduct
, with the following schema:
product_id | product_name | product_desc | product_price | product_img
在我从数据库中选择数据时,我希望以以下格式填写:
$product_array = array(
"105" => array( product_id => 105 , product_name => Blackberry 8900 ,
product_desc => , product_price => 1150.00 ,
product_img => products/product5.jpg ),
"106" => array( product_id => 106 , product_name => Headphone with mic ,
product_desc => , product_price => 148.85 ,
product_img => products/product8.jpg )
);
最佳做法