Jump to content

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>';
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.