cs1h Posted October 5, 2007 Share Posted October 5, 2007 Hi, Can anyone help me solve the following error, I'm sure it will be really basic but I am unable to see it. The error is Parse error: syntax error, unexpected '}' in D:\Inetpub\vhost\myroho.com\httpdocs\adding_countryprofile.php on line 6 and the code is, <?php //This gets all the other information from the form $country=$_POST['country']; $flag=$_POST['flag']; $text1=$_POST['text1']; $medical=$_POST['medical']; $top1=$_POST['top1']; $top2=$_POST['top2']; $top3=$_POST['top3']; $top4=$_POST['top4']; $top5=$_POST['top5']; $bot1=$_POST['bot1']; $bot2=$_POST['bot2']; $bot3=$_POST['bot3']; $bot4=$_POST['bot4']; $bot5=$_POST['bot5']; $map=$_POST['map']; $languages=$_POST['languages']; $currency=$_POST['currency']; // Connects to your Database mysql_connect("localhost", "zzz", "xxx") or die(mysql_error()) ; mysql_select_db("countryfile") or die(mysql_error()) ; //Writes the information to the database mysql_query($sql = "insert into `countryfile` (`country`, `flag`, `blurb`, `medical`, `top1`, `top2`, `top3`, `top4`, `top5`, `bot1`, `bot2`, `bot3`, `bot4`, `bot5`, `map`, `languages`, `currency`) values ('$country', '$flag', '$text1', '$medical', '$top1', '$top2', '$top3', '$top4', '$top5', '$bot1', '$bot2', '$bot3', '$bot4', '$bot5', '$map', '$languages', '$currency')"); //Tells you if its all ok echo "ok"; } else { //Gives and error if its not echo "didnt work"; } ?> Any help is much appriciated, Thanks Colin Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/ Share on other sites More sharing options...
Yesideez Posted October 5, 2007 Share Posted October 5, 2007 Is that the file adding_countryprofile.php? I ask as I can't see an error on that file... Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/#findComment-362391 Share on other sites More sharing options...
adam291086 Posted October 5, 2007 Share Posted October 5, 2007 You have a } above the else thats below the Echo Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/#findComment-362395 Share on other sites More sharing options...
Yesideez Posted October 5, 2007 Share Posted October 5, 2007 oops I didn't spot that as there was an else statement and automatically presumed there was an if statement which there isn't. Either add if somewhere or remove that else clause. Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/#findComment-362400 Share on other sites More sharing options...
adam291086 Posted October 5, 2007 Share Posted October 5, 2007 We all miss the basic stuff sometime, i am a newbie and that's what i look for first as i dont know enough yet. Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/#findComment-362409 Share on other sites More sharing options...
cs1h Posted October 5, 2007 Author Share Posted October 5, 2007 Thanks that works great. Quote Link to comment https://forums.phpfreaks.com/topic/71955-solved-help-unknown-syntax-error/#findComment-362431 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.