unexpected T_VARIABLE..... WHERE?

Associate
Joined
18 Oct 2002
Posts
858
Location
Cheshire
Gettin error

PHP Parse error: parse error, unexpected T_VARIABLE in /srv/www/htdocs/vatexempt/done.php on line 19

line 19 is...

$update_order = sprintf("UPDATE orders SET orders_status = 2 AND exemption_ID = %s WHERE orders_id = %s", $colname_get_exemption_id, echo $row_get_order['orders_id']);

now, $colname_get_exemption_id is defined at these lines....

$colname_get_exemption_id = "0";
if (isset($_GET['vatid'])) {
$colname_get_exemption_id = (get_magic_quotes_gpc()) ? $_GET['vatid'] : addslashes($_GET['vatid']);
}


perhaps I been at this too long but I just cant see the problem....

Can someone spot it....

Thanks
 
Your first snippet is invalid - there's an 'echo' in the middle of it. As echo is a language construct and doesn't return anything, you can't use it in that context. Did you mean:

Code:
$update_order = sprintf("UPDATE orders SET orders_status = 2 AND exemption_ID = %s WHERE orders_id = %s", $colname_get_exemption_id, $row_get_order['orders_id']);

? :)

arty
 
Same Error same line....

$row_get_order['orders_id'] is defined for the lines....

mysql_select_db($database_osc_connection, $osc_connection);
$query_get_order = sprintf("SELECT orders_id, orders_status, exemption_ID FROM orders WHERE customers_id = %s AND orders_status = 7 ORDER BY date_purchased DESC", $colname_get_order);
$get_order = mysql_query($query_get_order, $osc_connection) or die(mysql_error());
$row_get_order = mysql_fetch_assoc($get_order);
$totalRows_get_order = mysql_num_rows($get_order);

Basically, a mysql lookup....

I've looked again this morning and I just can't see the problem....
The whole file is below....

<?php require_once('Connections/osc_connection.php'); ?>
<?php
$colname_get_order = "0";
if (isset($_GET['customers_id'])) {
$colname_get_order = (get_magic_quotes_gpc()) ? $_GET['customers_id'] : addslashes($_GET['customers_id']);
}
$colname_get_exemption_id = "0";
if (isset($_GET['vatid'])) {
$colname_get_exemption_id = (get_magic_quotes_gpc()) ? $_GET['vatid'] : addslashes($_GET['vatid']);
}
mysql_select_db($database_osc_connection, $osc_connection);
$query_get_order = sprintf("SELECT orders_id, orders_status, exemption_ID FROM orders WHERE customers_id = %s AND orders_status = 7 ORDER BY date_purchased DESC", $colname_get_order);
$get_order = mysql_query($query_get_order, $osc_connection) or die(mysql_error());
$row_get_order = mysql_fetch_assoc($get_order);
$totalRows_get_order = mysql_num_rows($get_order);
// alter order
$row_get_order['orders_status'] = "2"
// put alterd data
$update_order = sprintf("UPDATE orders SET orders_status = 2 AND exemption_ID = %s WHERE orders_id = %s", $colname_get_exemption_id, $row_get_order['orders_id']);
//$get_order_update_return = mysql_query($update_get_order, $osc_connection) or die(mysql_error());
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mobility People Exemption Form Submitted</title>
</head>

<body>

<p>Thank you for completing the V.A.T. Exemption form.</p>
<p>If this window does not close, you may close it by clicking on the X in the top right.</p>
<p>&nbsp;</p>
<p>################# Debug area #############################</p>
<?php echo $colname_get_exemption_id ?><br>
<?php echo $row_get_order['orders_id'] ?>
<br>
<?php echo $update_order ?>

<table border="1">
<tr>
<td>orders_id</td>
<td>orders_status</td>
<td>exemption_ID</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_get_order['orders_id']; ?></td>
<td><?php echo $row_get_order['orders_status']; ?></td>
<td><?php echo $row_get_order['exemption_ID']; ?></td>
</tr>
<?php } while ($row_get_order = mysql_fetch_assoc($get_order)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($get_order);
?>

the URL is http://lamp1/vatexempt/done.php?customers_id=18&vatid=64
LAMP1 is my testing server and not an external domain....

//$get_order_update_return = mysql_query($update_get_order, $osc_connection) or die(mysql_error());
is commented out coz I don't want it to start changing the database yet....
 
Augmented said:
Code:
$row_get_order['orders_status'] = "2"
Missing a closing semi-colon.

arse! :mad:

Thanks Augmented, love ya

Dj_Jestar said:
Code:
People who don't use code tags burn in hell.[/QUOTE]

No offence DJ_jester, but my main concern is getting the code to work, cosmetics and commenting can come later (unless it a huge piece of complex code)....
 
yoda said:
No offence DJ_jester, but my main concern is getting the code to work, cosmetics and commenting can come later (unless it a huge piece of complex code)....

He's talking about code tags on the forums. Compare:

Code:
if ( fooble )
{
    bar();
    foreach ( string foo in baz )
    {
        lol(foo);
    }
}


if ( fooble )
{
bar();
foreach ( string foo in baz )
{
lol(foo);
}
}


Which is more readable?
 
Ah, didn't know we had that feature.... :cool:

Ok, I'll use that from now on.....

now I've got a problem with the SQL statement...

Code:
UPDATE orders SET orders_status = 2 AND exemption_ID = 70 WHERE orders_id =  17


in the PHP it returns the error "Query was empty"
However when I paste the statement into PHPMYADMIN it updates one row incorrectly:confused: (Affected rows: 1 (Query took 0.0007 sec))

It changes the orders_status to 0 and exemption_ID is still NULL

I have no clue as to what is wrong... any ideas?

Thanks
 
Back
Top Bottom