country)
$ship_name = $name:
$ship_address = $address;
Sship city Scity;
$5
hip state state;
}
$ship zip Sz1p;
$ship_country $country:
Sconn db_connect();
//insert customer address
$query "select customerid from customers where
name Sname and address '$address'
and city =
'Scity and state $state'
and zip '$zip' and country $country":
$result = mysql_query($query):
if(mysql_numrows($result)>0)
{
}
$customer_id = mysql_result($result, @, "customerid");
else
{
$query = "insert into cus
tomers values
(*, "Sname', '$address', '$city', '$state', '$zip', '$country")":
$result = mysql_query($query);
if ($result)
return false;
$query "select customerid from customers where
name $name and address
and city '$city' and state= '$state'
and zip $zip' and country Scountry'";
$result = mysql_query($query);
if(mysql_numrows($result)>0)
$customerid mysql_result($result, 8. "customerid");
else
turn false;
$date date("Y
$query = "insert into orders values
md");
( $customerid, $total_price, '$date', 'PARTIAL. Sship_name',
'$ship_address', '$ship_city', 'Sship_state", "Sship_zip'.
'Sship_country')";
$result = mysql_query($query);
if (!$result)
return false;
$query "select orderid from orders where
customertd $customerid and
amount $total_price
amount total_price+.001 and
date 'date' and
order_status = 'PARTIAL' and
ship_name '$ship_name' and
ship_address='$ship_address' and
='$address'
- .001 and
بناء عربة تسوق الفصل 25
620
ص٦٠٤