Jump to content

Recommended Posts

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>";
}


?>

Link to comment
https://forums.phpfreaks.com/topic/193617-what-now/
Share on other sites

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....

Link to comment
https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019199
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019201
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/193617-what-now/#findComment-1019239
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.