iGuest 3 Report post Posted May 27, 2012 (edited) Okey, so I got this error: Parse error: syntax error, unexpected T_STRING in C:wampwwwragnhildprosjekt1visinnlegg.php on line 48 I've read about T_STRING but I cant solve this problem. Here is the code: if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO kommentar (tittel, navn, tekst, tidsstempel, innleggid) VALUES ( %s, %s, %s, NOW(), %s)' GetSQLValueString($_POST['tittel'], "text"), GetSQLValueString($_POST['navn'], "text"), GetSQLValueString($_POST['tekst'], "text"), GetSQLValueString($_GET['innleggid'], "int") ); and line 48 is: GetSQLValueString($_POST['tittel'], "text"),Can somebody please help me out with this? Edited May 28, 2012 by moderator (see edit history) Share this post Link to post Share on other sites
multfilm 0 Report post Posted May 28, 2012 The problem is actually on line 47: you open the "INSERT INTO..." with a double quote, but close it with a single quote. And the PHP interpreter thinks the single quote is a part of the string started at the beginning, and that that string is continuing onto line 48... now when you finally have a double string, "text", it thinks that's where the string ends, and it doesn't know what to do with the line that says "text", since you would need a closing parentheses of the sprintf, or a comma for the next parameter, before you can make any new assertions like that: and that's why you get that error. Oh, and just for the future, to make sure you don't make the same mistake again, you should've been able to figure all this out simply by looking at the fact that the GetSQLValueString is green instead of black in the code parser previewer on this forum. Share this post Link to post Share on other sites
k_nitin_r 8 Report post Posted May 29, 2012 You have got a problem with the quotes in the code snippet that you have posted. If you are using Notepad or a text editor that does not automatically create the closing quote for you when you type the opening quote, I would suggest that you try a different PHP editor. NuSphere's PhpEd is good stuff. Komodo makes a good IDE and editor too, but they do have stability issues that they are trying to work out - when they do, they'll have a good product to offer. Notepad++ and many other free editors, will show you the closing quote when you click on the opening quote or vice-versa. Try different source code editors and see what works for your coding style. Share this post Link to post Share on other sites