Jump to content

[SOLVED] In the T_STRING Vortex


Skor

Recommended Posts

In my test script I just added an if conditional and can't seem to get out of the T_STRING vortex.

 

I just added the IF statement tonite. The update has been in place for a few months now and worked file. Putting it at the else has wreaked havoc apparently. Here's what I have. This is my testing utility that's why there's so many echos.

 

PHP Code:

$code = substr($desc,-6,1);
echo "Code = $code <br>";


if ($code == 'B') {
$insertqty = "INSERT INTO qytorders
(cat_code, order_num, pid, price, sold_date, sold_code, quantity, order_id, email, discount)  
VALUES ('$code','','$pid','$money','NOW()','QTY','$qty','$id','$email','$discount');
mysql_query ($insertqty);
echo '...Insert data into qytorders <br>';
}

else {  
//The error message is on the following line:
// Parse error: syntax error, unexpected T_STRING
// This code worked fine before the IF statement. ???
$update = "UPDATE ckd_labinv  
SET status ='S',
sold_code = 'SLD', sold_date = NOW()
WHERE pid = '$pid'
and status = 'A'";
$result = mysql_query($update) or die (mysql_error());
}
  $num_rows = mysql_affected_rows();//$result
  echo "<br>Number of Rows: $num_rows<br>";

 

What did I miss here? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/84840-solved-in-the-t_string-vortex/
Share on other sites

You didn't close the INSERT statement. You forgot another ' " '.

 

if ($code == 'B') {
$insertqty = "INSERT INTO qytorders
(cat_code, order_num, pid, price, sold_date, sold_code, quantity, order_id, email, discount)  
VALUES ('$code','','$pid','$money','NOW()','QTY','$qty','$id','$email','$discount');
mysql_query ($insertqty);
echo '...Insert data into qytorders <br>';
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.