473,224 Members | 1,731 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Parse error: parse error, unexpected T_STRING

Hi people, keep getting this errorParse error: parse error, unexpected
T_STRING in order_fns.php line 91. the code is below for the file and
I've indicated line 91

<?php
function process_card($card_details)
{
// connect to payment gateway or
// use gpg to encrypt and mail or
// store in DB if you really want to

return true;
}

function insert_order($order_details)
{
global $HTTP_SESSION_VARS;

//extract order_details out as variables
extract($order_details);
//set shipping address same as address
if(!$ship_name&&!$ship_address&&!$ship_city&&!$shi p_state&&!$ship_zip&&!$ship_country)
{
$ship_name = $name;
$ship_address = $address;
$ship_city = $city;
$ship_state = $state;
$ship_zip = $zip;
$ship_country = $country;
}

$conn = db_connect();

//insert customer address
$query = "select customerid from customers where
name = '$name' and address = '$address'
and city = '$city' and state = '$state'
and zip = '$zip' and country = '$country'";
$result = mysql_query($query);
if(mysql_numrows($result)>0)
{
$customer_id = mysql_result($result, 0, 'customerid');
}
else
{
$query = "insert into customers values
('', '$name','$address','$city','$state','$zip','$count ry')";
$result = mysql_query($query);
if (!$result)
return false;
}
$query = "select customerid from customers where
name = '$name' and address = '$address'
and city = '$city' and state = '$state'
and zip = '$zip' and country = '$country'";
$result = mysql_query($query);
if(mysql_numrows($result)>0)
$customerid = mysql_result($result, 0, 'customerid');
else
return false;
$date = date('Y-m-d');
$query = "insert into orders values
('', $customerid, ".$HTTP_SESSION_VARS['total_price'].",
'$date', 'PARTIAL', '$ship_name',
'$ship_address','$ship_city','$ship_state','$ship_ zip',
'$ship_country')";
$result = mysql_query($query);
if (!$result)
return false;

$query = "select orderid from orders where
customerid = $customerid and
amount > ".$HTTP_SESSION_VARS['total_price']."-.001 and
amount < ".$HTTP_SESSION_VARS['total_price']."+.001 and
date = '$date' and
order_status = 'PARTIAL' and
ship_name = '$ship_name' and
ship_address = '$ship_address' and
ship_city = '$ship_city' and
ship_state = '$ship_state' and
ship_zip = '$ship_zip' and
ship_country = '$ship_country';
$result = mysql_query($query);
if(mysql_numrows($result)>0)
$orderid = mysql_result($result, 0, 'orderid');
else
return false;
// insert each book
foreach($HTTP_SESSION_VARS['cart'] as $isbn => $quantity)
{
$detail = get_book_details($isbn);
/*Line 91*/$query = "delete from order_items where
orderid = '" . $orderid . "' and isbn = '" . $isbn .
"'";
$result = mysql_query($query);
$query = "insert into order_items values
('$orderid', '$isbn', ".$detail['price'].", $quantity");
$result = mysql_query($query);
if(!$result)
return false;
}

return $orderid;
}

?>

but I think its got to do with the line before

$detail = get_book_details($isbn); and here is the get_book_details
function

function get_book_details($isbn)
{
// query database for all details for a particular book
if (!$isbn || $isbn=='')
return false;

$conn = db_connect();
$query = "select * from books where isbn='$isbn'";
$result = @mysql_query($query);
if (!$result)
return false;
$result = @mysql_fetch_array($result);
return $result;
}
Jul 17 '05 #1
2 2854
.oO(Salim)
Hi people, keep getting this errorParse error: parse error, unexpected
T_STRING in order_fns.php line 91. the code is below for the file and
I've indicated line 91


You should use an editor with syntax highlighting. The problem is not on
line 91, but on line 79:

ship_country = '$ship_country';

The string started with a double quote on line 68, but you didn't close
it. Changing line 79 to

ship_country = '$ship_country'";

should fix it.

Micha
Jul 17 '05 #2
Salim wrote:
Hi people, keep getting this errorParse error: parse error, unexpected
T_STRING in order_fns.php line 91. the code is below for the file and
I've indicated line 91


$query = "select orderid from orders where
customerid = $customerid and
amount > ".$HTTP_SESSION_VARS['total_price']."-.001 and
amount < ".$HTTP_SESSION_VARS['total_price']."+.001 and
date = '$date' and
order_status = 'PARTIAL' and
ship_name = '$ship_name' and
ship_address = '$ship_address' and
ship_city = '$ship_city' and
ship_state = '$ship_state' and
ship_zip = '$ship_zip' and
ship_country = '$ship_country';

Needs double quote before the ;.

ship_country = '$ship_country'";

(A text editor with syntax colouring would have prevented this error.)

JP

--
Sorry, <de*****@cauce.org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword')...
4
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
3
by: sclarkstone | last post by:
Im getting this error; Parse error: syntax error, unexpected T_STRING, expecting ':' or ';' with this line; header ('postcodesearch.php?e=nw&pcode=',); I cant find whats wrong, can anyone...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
3
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 ...
11
by: JRough | last post by:
I'm trying to use output buffering to cheat so i can print to excel which is called later than this header(). header("Content-type: application/xmsdownload"); header("Content-Disposition:...
0
by: JRough | last post by:
On Sep 26, 3:23pm, Captain Paralytic <paul_laut...@yahoo.comwrote: without the exit I get this again: Warning: Cannot modify header information - headers already sent by (output started at...
10
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php ...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.