Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse Probs

Status
Not open for further replies.

boab

Programmer
May 30, 2001
75
GB
Hi guys parse errors again and I can't see the problem I am getting an error when viewing the page:
Parse error: parse error in order_fns.php on line 51

the code I am using is

11 function insert_order($order_details)
12{
13 global $total_price;
14 global $cart;
15 //extract order_details out as variables
16 extract($order_details);
17
18
19 //set shipping address same as address
20 if(!$ship_name&&!$ship_1st_add&&!$ship_2nd_add&&!21 $ship_city&&!$ship_state&&!$ship_zip&&!$ship_country)
21 {
22 $ship_name = $name;
23 $ship_1st_add = $first_add;
24 $ship_2nd_add = $second_add;
25 $ship_city = $city;
26 $ship_state = $state;
27 $ship_zip = $zip;
28 $ship_country = $country;
29 }
30
31 $conn = db_connect();
32
33 //insert customer address
34 $query = "select customerid from contact where
35 name = '$name' and 1st_add = '$first_add'
36 and 2nd_add = '$second_add' and town
= '$city' and state = '$state'
37 and zip = '$zip' and country = '$country'";
38 $result = mysql_query($query);
39 if(mysql_numrows($result)>0 )
40 {
41 $customer_id = mysql_result($result,
0, "customerid");
42 }
43 else
44 {
45 $query = "insert into contact values (
46 '', '$first_add', '$second_add','$city','$zip', '$email', '$fax', '$name', '$country', '$state', '$tel' );
47 $result = mysql_query($query);
48 if (!$result)
49 return false;
50 }
51 $query = "select customerid from contact where
52 name = '$name' and 1st_add = '$first_add'
53 and 2nd_add = '$second_add' and town = '$city' and state = '$state'
54 and zip = '$zip' and country = '$country'";
55 $result = mysql_query($query);
56 if(mysql_numrows($result)>0)
57 $customerid = mysql_result($result, 0, "customerid");
58
59 else
60 return false;
61 $date = date("Y-m-d");
62 $query = "insert into orders values
63 ('', $customerid, $total_price, '$date', 'PARTIAL', '$ship_name',
64 '$ship_1st_add','$ship_2nd_add', '$ship_city','$ship_state','$ship_zip',
65 '$ship_country')";
66 $result = mysql_query($query);
67 if (!$result)
68 return false;
69
70 $query = "select orderid from orders where
71 customerid = $customerid and
72 amount > $total_price-.001 and
73 amount < $total_price+.001 and
74 date = '$date' and
order_status = 'PARTIAL' and
ship_name = '$ship_name' and
ship_1st_add = '$ship_1st_add' and
ship_2nd_add = '$ship_2nd_add' and
ship_city = '$ship_city' and
ship_state = '$ship_state' and
ship_zip = '$ship_zip' and
ship_country = '$ship_country'&quot;;
$result = mysql_query($query);
if(mysql_numrows($result)>0)
$orderid = mysql_result($result, 0, &quot;orderid&quot;);
else
return false;


// insert each product
foreach($cart as $productID => $quantity)
{
$detail = get_product_details($productId);
$query = &quot;delete from order_items where
orderid = '$orderid' and productId = '$productId'&quot;;
$result = mysql_query($query);
$query = &quot;insert into order_items values
('$orderid', '$productID', &quot;.$detail[&quot;price&quot;].&quot;, $quantity)&quot;;
$result = mysql_query($query);
if(!$result)
return false;
}

return $orderid;
}

The problem I think is locatedin line 39 - reasons when I edit the coed in Dreamweaver the code colour changes from the blue of reserved keywords to black of text at the 0.If this is significant I don't know the error I think is strange as the query on line 34 uses exactly the same code and doesn't generate an error (yet!) Any ideas would be appreciated

Cheers
 
i think the problem is on the line 46 - it should be:

'', '$first_add', '$second_add','$city','$zip', '$email', '$fax', '$name', '$country', '$state', '$tel' )&quot;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top