topflight Posted October 7, 2008 Share Posted October 7, 2008 I am new to php and I was just playing around making a code and now I am receiving Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\addnewsv.php on line 44 this error message and this is line 44 $update = mysql_query("INSERT INTO `news` (authorname,date,newstitle,newsart,ip) VALUES ('$_POST[authorname]','$now','$_POST[newstitle]','$_POST[newsart]','$ip')")or die mysql_error()); many somebody please tell me what the matter is. Thanks in advanced. Link to comment https://forums.phpfreaks.com/topic/127341-t-string/ Share on other sites More sharing options...
R0bb0b Posted October 7, 2008 Share Posted October 7, 2008 try this <?php $update = mysql_query("INSERT INTO `news` (authorname,date,newstitle,newsart,ip) VALUES ('".mysql_real_escape_string($_POST['authorname'])."','$now','".mysql_real_escape_string($_POST['newstitle'])."','".mysql_real_escape_string($_POST['newsart'])."','$ip')")or die (mysql_error()); ?> always use mysql_real_escape_string at the very minimum for user input Link to comment https://forums.phpfreaks.com/topic/127341-t-string/#findComment-658742 Share on other sites More sharing options...
topflight Posted October 7, 2008 Author Share Posted October 7, 2008 thanks it worked Link to comment https://forums.phpfreaks.com/topic/127341-t-string/#findComment-658743 Share on other sites More sharing options...
Brian W Posted October 7, 2008 Share Posted October 7, 2008 T String i'm pretty sure refers to String, like $string or $foo_bar. Unexpected T String usually comes up when you don't use a semi colen when you should (so look at the previous line of code. For instance: error on line 44, look at line 43) or when you don't close up a statement (for instance in a if statement: if(isset($string){ $stuff= "foo"; } //you'd be missing the second ")" in the statement and it would likely tell you unexpected T string or {, I don't remember) That is just in my experience and imho. Best of luck in you learnings. Link to comment https://forums.phpfreaks.com/topic/127341-t-string/#findComment-658745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.