My code is trying to assign a truck per location. My problem is in the Truck column, only one truck value is assigned for all, but when I use echo to see if my if-else works, it does. In fact, the correct truck is assigned for each location. But in the database, only 1 type of truck (e.g. truck1) is assigned for all. Please help. Thanks is advance!
<?php
include ("database_connection.php");
connect();
$i = 0;
$result1 = mysql_query("SELECT * FROM `customer_information` ci join `customer_order` co WHERE ci.Customer_Number= co.Customer_Number AND co.Customer_Number = co.Customer_Number");
$count = mysql_num_rows($result1);
if ($count != 0)
while($row1 = mysql_fetch_array($result1)){
$i++;
$order_no = $row1['Order_Number'];
$cust_no = $row1['Customer_Number'];
$receipt_no = $row1['Receipt_Number'];
$date_ordered = $row1['Date_Ordered'];
$exp_date = $row1['Expected_Date'];
$location = $row1['Location'];
if ($location == 'place1' || $location == 'place2' || $location == 'place3')
{
$truck = "truck1";
} else if ($location == 'place4' || $location == 'place5' || $location == 'Caloocan' || $location == 'place7')
{
$truck = "truck2";
} else if ($location == 'place8' || $location == 'place9')
{
$truck = "truck3";
}
mysql_query("UPDATE customer_order set `Truck` = '$truck' where Location = '$location'");
}
?>