php - I want get one array from database records -
this question has answer here:
i fetching records database return records in multiple array. want 1 array database.
my php code -
$resultdata = array(); $re=mysql_query("select pro_ref_id,pro_qty,pro_item proforma_details pro_ref_id in($piid_str)"); while($re1=mysql_fetch_array($re)) { $rq=mysql_fetch_array(mysql_query("select sale_ref_id,proforma_invoice_no proforma_invoice pro_invoice_id='".$re1['pro_ref_id']."'")); $rq1=mysql_fetch_array(mysql_query("select sale_order_no sale_order sale_id='".$rq['sale_ref_id']."'")); array_push($resultdata,$re1); array_push($resultdata,$rq); array_push($resultdata,$rq1); }
i getting array -
array( [0] => array( [0] => 1 [pro_ref_id] => 1 ) [1] => array( [0] => 1 [sale_ref_id] => 1 )
and want -
array( [0] => 1 [pro_ref_id] => 1 [1] => 1 [sale_ref_id] => 1 )
instead of using mysql_fetch_array()
use mysql_fetch_assoc()
also mysql_* deprecated use pdo or mysqli
Comments
Post a Comment