Bisa Posted May 25, 2006 Share Posted May 25, 2006 Hi, i figured since I started learning php yesterday im still a newb [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] thus posting in here and not in "php Help".well, to the problem.Below is my "savenews.php" a file the user is directed to when trying to add a news item on the blog-site im working with.[code]Parse error: syntax error, unexpected T_EXIT in savenews.php on line 14[/code]Is all i get when trying to save my news :( If I remove the if (!mysql_query($sql,$con) and the next line all I get is the Success message but nothing is added to mysql database.could any1 help me spot the problem?[code]<?phpinclude ("databaseconnection.php"); //Connection with the mysql-server.mysql_select_db("blog", $con); //Select database to work with.$date = date('Y-m-d H:i:s'); //Assign time/date.$sql="INSERT INTO news (subject, text, date) VALUES ('".mysql_real_escape_string($_POST['subject'])."', '".mysql_real_escape_string($_POST['text'])."', '".$date."')"; //Insert subject, text and date into the table news.if (!mysql_query($sql,$con) die('Error: ' . mysql_error());echo "Success!";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10417-problem-finding-my-error/ Share on other sites More sharing options...
wildteen88 Posted May 25, 2006 Share Posted May 25, 2006 You forgot to put a closing '[b])[/b]' bracket on this line:[code]if (!mysql_query($sql,$con)[/code] if you add an ) at the end of that line it should sort out your error. Quote Link to comment https://forums.phpfreaks.com/topic/10417-problem-finding-my-error/#findComment-38819 Share on other sites More sharing options...
Bisa Posted May 25, 2006 Author Share Posted May 25, 2006 Ah =) you got to love the n00b-iness of that [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] thnx for the help, it sorted my problem (but creating another1, but thats another story) Quote Link to comment https://forums.phpfreaks.com/topic/10417-problem-finding-my-error/#findComment-38822 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.