hello here is my code which i have written in the codeigniter controller,when i run this code am getting Parse error: syntax error, unexpected 'foreach' (T_FOREACH) ,kindly help me on this
function send_payment_notification()
{
if($_POST)
{
$vendor_id=$_POST['vendor_id'];
$vendor_name=$_POST['vendor_name'];
$from_date=$_POST['from_date'];
$to_date=$_POST['to_date'];
for($i=0;$i<count($vendor_id);$i++)
{
$v_id= $vendor_id[$i];
$v_name= $vendor_name[$i];
$f_date=$from_date[$i];
$t_date=$to_date[$i];
$query="select * from `order` where (DATE(order.service_date) between '".$f_date."' and '".$t_date."') AND status_code='OCMP' and order.vendor_id=$v_id";
$data['order_ids']=$this->finance_model->run_manual_query_return_result2($query);
$query="SELECT v.vendor_email,c.cat_name,c.commission_type,c.commission,sum(c.commission) commissionrupees, SUM( CASE WHEN final_amount_paid !=0 THEN final_amount_paid ELSE total_cost END ) AS total,order.vendor_id,v.vendor_name,sum(distinct v.wallet_balance) as wallet FROM `order` join vendor v on v.vendor_id=order.vendor_id join category c on c.cat_id=v.cat_id where (DATE(order.service_date) between '".$f_date."' and '".$t_date."') AND status_code='OCMP' and order.vendor_id=$v_id";
$payment_notification=$this->finance_model->run_manual_query_return_row($query);
$template="
Hi Service Providers,
Please find payment details for the week ".$f_date." to ".$t_date." .
<table>
<tr> <th>Category </th><th>order ids </th><th>Total Amount </th> <th>Commission charged </th><th>online payment </th><th>Bro4u offers </th><th>Total payable </th> </tr>
<tr>
<td>".$payment_notification->cat_name."</td>
<td>"foreach($data['order_ids'] as $o_id)
{
$o_id->order_id
}"</td>
<td>".$payment_notification->total."</td>
<td>".$payment_notification->commissionrupees."</td>
<td>online</td>
<td>offers</td>
<td>payable</td>
</tr>
</table>
<br/>
Happy to serve,<br/>
Team Bro4u<br/>
";
//$this->bro4u->email_alert($payment_notification->vendor_email, "credit of amount", $template);
echo $template;
}
}
}