if($query->num_rows()>0)
{
foreach($query->result() as $row)
{
$slNo = $row->sl_no;
//echo "</br>";
$sql1 = "SELECT * FROM main_stock_outward WHERE product_id='$slNo' AND request_id='$requestId'";
//echo "</br>";
$query1 = $this->db->query($sql1);
if (!($query1->num_rows() > 0))
{
echo "hi";
echo $sql2 = "SELECT a.sl_no,a.product_name,a.barcode,b.request_qty,b.deliver FROM stock_product a, stock_request b WHERE b.pos_id='$posNum' AND b.ordered_date like '$requestIssueDate%' AND b.request_id='$requestId' AND a.sl_no='$slNo' AND b.deliver='0' AND a.barcode=b.product_barcode ORDER BY request_qty DESC";
$query2 = $this->db->query($sql2);
//return $query2;
$arr_data['query3']**[]** =array('sales' => $query2);
//$query3 = array(
// 'sales' => $query2);
}
}
print_r($arr_data['query3']);
return $query2;
}
вы пропустили создание массива, я изменил строку - $ arr_data ['query3'] = array ('sales' => $ query2);as $ arr_data ['query3'] [] = array ('sales' => $ query2);
Я думаю, что ваша проблема решится этим.