Skor Posted January 7, 2008 Share Posted January 7, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/84840-solved-in-the-t_string-vortex/ Share on other sites More sharing options...
stuffradio Posted January 7, 2008 Share Posted January 7, 2008 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>'; } Quote Link to comment https://forums.phpfreaks.com/topic/84840-solved-in-the-t_string-vortex/#findComment-432512 Share on other sites More sharing options...
Skor Posted January 7, 2008 Author Share Posted January 7, 2008 Thanks, the woes of late night programming. Quote Link to comment https://forums.phpfreaks.com/topic/84840-solved-in-the-t_string-vortex/#findComment-432516 Share on other sites More sharing options...
stuffradio Posted January 7, 2008 Share Posted January 7, 2008 No problem Quote Link to comment https://forums.phpfreaks.com/topic/84840-solved-in-the-t_string-vortex/#findComment-432518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.