I have a cron that fires every Thursday, however I wanted to add some other lines to the cron but since im using FuelPhp, I cant do so because of the error attached in the image. Is there a way I can put queries like:
$getAllDiscounts = "select * from discount_order where order_id = '{$order->id}' and user_add != '1'";
$ResultgetAllDiscounts = mysqli_query($conn, $getAllDiscounts);
$countDiscount = 1;
if(mysqli_num_rows($ResultgetAllDiscounts) > 1)
{
while($RowgetAllDiscounts = mysqli_fetch_assoc($ResultgetAllDiscounts))
{
if($RowgetAllDiscounts['discount_code_id'] == $order->discount_code_id)
{
//empty
}
else{
$get_Othername = "select * from discount_codes where id = '{$RowgetAllDiscounts['discount_code_id']}'";
$result_Othername = mysqli_query($conn, $get_Othername);
$row_Othername = mysqli_fetch_assoc($result_Othername);
$Othercode_name = "Discount Code: ".ucwords($row_Othername['code']);
$otherType = $row_Othername['discount_type'];
//get discount
if($otherType == '1' || $otherType == '2' || $otherType == '5')
{
if($otherType == '2')
{
$otherDiscount = $order->subtotal * $row_Othername['discount'];
}
elseif($otherType == '5')
{
$Othercode_name = "Free Item!";
$discountSku = $row_Othername['sku_id'];
$q_getSkuAmount = "select price from meal_options where id = '{$discountSku}'";
$r_getSkuAmount = mysqli_query($conn,$q_getSkuAmount);
$row_getSkuAmount = mysqli_fetch_assoc($r_getSkuAmount);
$otherDiscount = $row_getSkuAmount['price']/100;
}
else{
$otherDiscount = $row_Othername['discount']/100;
}
$otherDiscount = number_format($otherDiscount,2);
}
$inBalance .= '<tr style="font-family:lora,georgia,times new roman,serif">
<td style="text-align: center;" width="15%"> </td>
<td width="65%">'.$Othercode_name.'</td>
<td style="text-align: left; white-space: nowrap;" width="20%">-$'.$otherDiscount.'</td>
</tr>';
}
$countDiscount++;
}
}
Because I have all the code ready in this format. But the $conn isnt working. Is there a way to fix it without having to make it through fuelPhp coding?
You just need to add a "\" before mysqli