3raser Posted June 17, 2010 Share Posted June 17, 2010 I'm just laughing at my dumbness......I seriously just need to stop working with PHP. I KEEP GETTING THESE PARSE ERRORS EVERYTIME I DO SOMETHING?! Parse error: parse error in C:\wamp\www\project11\join.php on line 32 <?php session_start(); $session = $_SESSION['user']; $mysql_host = "localhost"; $mysql_username = "root"; $mysql_password = ""; $mysql_database = "project11"; mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database); $id = $_GET['id']; if(!$id) { echo "You must select a clan to join first! <a href='index.php'>Home</a>"; } else { $extract = mysql_query("SELECT clan FROM users WHERE username='$session'"); while ($row = mysql_fetch_assoc($extract)) { $exist = $row['clan']; } if (!$clan) { if($does_it_exist = mysql_query("SELECT clan_name FROM clans WHERE clan='$id'")) { $check = mysql_num_rows($does_it_exist); if(!$check) { echo "Sorry, but no clan exists with the ID code of ". $id ."! <a href='index.php'>Home</a>"; } else { mysql_query("INSERT INTO requests VALUES ('', '$session', '$id')"); echo "Your request has been sent to the clan leader. Please wait for it to be approved!"; } else { echo "Sorry, an error occured."; } else { echo "Sorry, your already in a clan! <a href='index.php'>Home</a>"; } } ?> Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted June 17, 2010 Share Posted June 17, 2010 No, you just need to learn what causes a parse error. Seems to me you're missing a couple closing }'s Quote Link to comment Share on other sites More sharing options...
3raser Posted June 17, 2010 Author Share Posted June 17, 2010 How? I went into Notepad++, and checked everything.... Quote Link to comment Share on other sites More sharing options...
gizmola Posted June 17, 2010 Share Posted June 17, 2010 You're missing end block statements on at least one of your else statements around that location. Quote Link to comment Share on other sites More sharing options...
3raser Posted June 17, 2010 Author Share Posted June 17, 2010 Fixed a few of the brackets. <?php session_start(); $session = $_SESSION['user']; $mysql_host = "localhost"; $mysql_username = "root"; $mysql_password = ""; $mysql_database = "project11"; mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database); $id = $_GET['id']; if(!$id) { echo "You must select a clan to join first! <a href='index.php'>Home</a>"; } else { $extract = mysql_query("SELECT clan FROM users WHERE username='$session'"); while ($row = mysql_fetch_assoc($extract)) { $exist = $row['clan']; } if (!$clan) { if($does_it_exist = mysql_query("SELECT clan_name FROM clans WHERE clan='$id'")) { $check = mysql_num_rows($does_it_exist); if(!$check) { echo "Sorry, but no clan exists with the ID code of ". $id ."! <a href='index.php'>Home</a>"; } else { mysql_query("INSERT INTO requests VALUES ('', '$session', '$id')"); echo "Your request has been sent to the clan leader. Please wait for it to be approved!"; } else { echo "Sorry, an error occured."; } else { echo "Sorry, your already in a clan! <a href='index.php'>Home</a>"; } } } } ?> But still get Parse error: parse error in C:\wamp\www\project11\join.php on line 32 Quote Link to comment Share on other sites More sharing options...
gizmola Posted June 17, 2010 Share Posted June 17, 2010 I don't see how you fixed anything. You need to make sure that when you do if - else that you end the block. if () { } else { } You can't have: if () { } else { } else { You can have elseif or else if (). http://www.php.net/elseif Quote Link to comment 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.