3raser Posted February 28, 2010 Share Posted February 28, 2010 Parse error: syntax error, unexpected T_ELSE in /home/a2392706/public_html/done.php on line 51 Code: <?php $ip = $_SERVER['REMOTE_ADDR']; $get2 = mysql_query("SELECT * FROM done WHERE ip='$ip'"); while ($row2 = mysql_fetch_assoc($get2)) { $done = $row2['done']; } //seeing if they've started $construct = "SELECT * FROM ref WHERE ip='$ip'"; $run = mysql_query($construct); $foundnum = (mysql_num_rows($run)); $get = mysql_query("SELECT * FROM ref WHERE ip='$ip'"); while ($row = mysql_fetch_assoc($get)) { // get data $id = $row['id']; $ip = $row['ip']; $amountleft = $row['amountleft']; $pending = $row['pending']; } $amountleft1 = 3 - $amountleft; if ($done ==1) { echo "You've already submitted your forum link, please be patient. "; } else { if ($foundnum ==1) { if ($amountleft == 3) { echo "It seems you've completed the deal. Please, enter in the link to your forum:<br><br> <form action='sendinfo.php' method='POST'><input type='text' name='wlink' /><input type='submit' value='Send it!'></form> "; } else { echo "You haven't completed your refering deal, you must refer the REQUIRED amount of people. You need to refer ". $amountleft1 ." more."; } } } else { echo "You haven't even started. <a href='info.php'>Go here</a>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/ Share on other sites More sharing options...
seventheyejosh Posted February 28, 2010 Share Posted February 28, 2010 This: } else { echo "You haven't even started. <a href='info.php'>Go here</a>"; } has no beginning if. Also, both of your while loops are overwriting your variables. All you will ever end up with is the last values of the sql set.... Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019199 Share on other sites More sharing options...
seventheyejosh Posted February 28, 2010 Share Posted February 28, 2010 Try This: if ($done==1) { echo "You've already submitted your forum link, please be patient. "; }else{ if ($foundnum==1) { if ($amountleft==3) { echo "It seems you've completed the deal. Please, enter in the link to your forum:<br><br> <form action='sendinfo.php' method='POST'> <input type='text' name='wlink' /> <input type='submit' value='Send it!'> </form>"; } else { echo "You haven't completed your refering deal, you must refer the REQUIRED amount of people. You need to refer ". $amountleft1 ." more."; }//end if }else{ echo "You haven't even started. <a href='info.php'>Go here</a>"; }//end if }//end if Commenting and indentation are key to good programming. It doesnt matter how you do it, just do it and keep it uniform throughout your code. Also it occurs to me that your queries may be intentionally returning a single data set, and if that is the case, there is no need for a while loop. //for single set $res=mysql_query($query); $row=mysql_fetch_assoc($res); $val=$row['val']; //for multi set $res=mysql_query($query); while($row=mysql_fetch_assoc($res)){ echo $row['val']; //or store it or w/e array_push($laterArray,$row['val']); }//end while Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019201 Share on other sites More sharing options...
3raser Posted February 28, 2010 Author Share Posted February 28, 2010 Ok it's working, but how come when done does == 1 in my database, it still doesn't say "You've already submitted your forum link, please be patient. " Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019217 Share on other sites More sharing options...
seventheyejosh Posted February 28, 2010 Share Posted February 28, 2010 What is done's value? put this right above the done check echo 'Done is: '.$done; exit; Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019220 Share on other sites More sharing options...
3raser Posted February 28, 2010 Author Share Posted February 28, 2010 Never mind, I got it. And thank you for solving my problem Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019234 Share on other sites More sharing options...
3raser Posted February 28, 2010 Author Share Posted February 28, 2010 Also, I have ONE more error I forgot to post that is related to this somehow. Here is my code: if ($amountleft == 3) { $get2 = mysql_query("SELECT * FROM done WHERE ip='$ip'"); while ($row2 = mysql_fetch_assoc($get2)) { $done = $row2['done']; } $mv = "It seems you've reffered 3 people already, <a href='done.php'>tell us</a>."; if ($done ==1) { $mv = "Your forum link has been sent, and your posts will be done very soon. "; } echo $mv; } My error is: Parse error: syntax error, unexpected '}' in /home/a2392706/public_html/start.php on line 57 Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019239 Share on other sites More sharing options...
3raser Posted February 28, 2010 Author Share Posted February 28, 2010 Bump Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019256 Share on other sites More sharing options...
trq Posted February 28, 2010 Share Posted February 28, 2010 These are simple syntax errors. get yourself a decent code editor with syntax highlighting & indent your code consistently and these issues will be easy to find yourself. Quote Link to comment https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019282 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.