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. 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>'; } 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. 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 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
Archived
This topic is now archived and is closed to further replies.