SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2003
    Location
    sitepoint
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help finding missing bracket

    I've looked at this code over and over and can't see where the problem is, it says
    PHP Code:
    Parse errorparse errorunexpected '}' in profile.php on line 170 
    I've marked the line in the code, I usually don't have troubles with this and when I do can figure it out easy. BUt for some reason I'm just ot seeing it.

    PHP Code:
    if(isset($user)) 
    {
        $query = "SELECT * FROM users WHERE username='$user'";
        $result = @mysql_query($query) or die(mysql_error());
        
        if($result)
        {
            if(mysql_num_rows($result) == 1) 
            {
                $rows = mysql_fetch_array($result);
                $user_id = $rows['user_id'];
                $fname = $rows['first_name'];
                $age = $rows['age'];
                $gender = $rows['gender'];
                $regdate = $rows['reg_date'];
                $userlevel = $rows['user_level'];
                $user = $rows['username'];
                $main = $rows['main'];
                
                if($userlevel == 0)
                {
                    if($userlevel == 0 && $_SESSION['ul'] > 2)
                    {
                        echo "<p><font size=\"-1\" color=\"red\">This account is currently waiting reinstatement/suspension and can only be seen by admins.</font></p><br>";
                        
                        $query = "SELECT image_id,image_name,mod FROM images WHERE user_id='$user_id' AND main='1'";
                        $result = @mysql_query($query) or die(mysql_error());
                        $row = mysql_fetch_array($result);
                        $iname = $row['image_name'];
                        $iid = $row['image_id'];
                        $ban = $row['mod'];
                        
                        if($ban == 2)
                        {
                            echo "<center><img id=\"MainImg\" src=\"../pics/users/full/".$iname.$iid.".jpg\" ></center>";
                            echo "<br>";
                        } elseif(!mysql_num_rows($result) == 1) {
                            
                        } else {
                            echo "<center><img src=\"../pics/users/approvalbig.jpg\"/></center>";
                            echo "<br>";
                        }
                        
                        $query = "SELECT image_id, mod FROM images WHERE user_id='$user_id' AND main='0' ORDER BY date";
                        $result = @mysql_query($query);?>
                        <table class="pics"><tr>
                        <td><?php echo "<img src=\"../pics/users/thumb/".$iname.$iid." onclick=\"CngImg(0,'../pics/users/full/".$iname.$iid.".jpg');\" >";?></td>
                        <?php while($row mysql_fetch_array($result))
                        {    
    $count++;
                        
    extract($row);
                            if(
    $mod == 2)
                            {
                            echo 
    "<td>";
                            echo 
    "<img src=\"../pics/users/thumb/".$iname.$image_id." onclick=\"CngImg(".$count.",'../pics/users/full/".$iname.$image_id.".jpg');\" >";
                            echo 
    "</td>";
                            } else {
                                echo 
    "<td>";
                                echo 
    "<img src=\"../pics/users/approvalsmall.jpg\"/></center>";
                                echo 
    "</td>";
                            }
                        }
    ?>
                        </tr></table>
                        <table class="profile">
                            <tr class="Dark">
                                <td align="right">Date Registered: </td>
                                <td><?php echo date('l, F j, Y'strtotime($regdate));?></td>
                            </tr>
                            <tr class="Light">
                                <td align="right">Name: </td>
                                <td><?php echo $fname?></td>
                            </tr>
                            <tr class="Dark">
                                <td align="right">Age: </td>
                                <td><?php echo $age?></td>
                            </tr>
                            <tr class="Light">
                                <td align="right">Gender: </td>
                                <td><?php echo $gender?></td>
                            </tr>
                        </table>
                        <?php
                        
    }
                    } else {
                        echo 
    "This users account has temporarily been suspended for further review.";
                    }
                } elseif(
    $userlevel == 1) {
                    echo 
    "Account still awaiting activation. If this is your account check your email that you used to register with for further instructions.";
                } else {
                    
    $query "SELECT image_id,image_name,mod FROM images WHERE user_id='$user_id' AND main='1'";
                    
    $result = @mysql_query($query) or die(mysql_error());
                    
    $row mysql_fetch_array($result);
                    
    $inme $row['image_name'];
                    
    $iid $row['image_id'];
                    
    $ban $row['mod'];
                        
                    if(
    $ban == 2)
                    {
                        echo 
    "<center><img id=\"MainImg\" src=\"../pics/users/full/".$iname.$iid.".jpg\" ></center>";
                        echo 
    "<br>";
                    } elseif(!
    mysql_num_rows($result) == 1) {
                            
                    } else {
                        echo 
    "<center><img src=\"../pics/users/approvalbig.jpg\"/></center>";
                        echo 
    "<br>";
                    }
                        
                    
    $query "SELECT image_id, mod FROM images WHERE user_id='$user_id' AND main='0' ORDER BY date";
                    
    $result = @mysql_query($query);?>
                    <table class="pics"><tr>
                    <td><?php echo "<img src=\"../pics/users/thumb/".$iname.$iid." onclick=\"CngImg(0,'../pics/users/full/".$iname.$iid.".jpg');\" >";?></td>
                    <?php while($row mysql_fetch_array($result))
                    {    
    $count++;
                    
    extract($row);
                        if(
    $mod == 2)
                        {
                        echo 
    "<td>";
                        echo 
    "<img src=\"../pics/users/thumb/".$iname.$image_id." onclick=\"CngImg(".$count.",'../pics/users/full/".$iname.$image_id.".jpg');\" >";
                        echo 
    "</td>";
                        } else {
                            echo 
    "<td>";
                            echo 
    "<img src=\"../pics/users/approvalsmall.jpg\"/></center>";
                            echo 
    "</td>";
                        }
                    }
    ?>
                        </tr></table>
                        <table class="profile">
                            <tr class="Dark">
                                <td align="right">Date Registered: </td>
                                <td><?php echo date('l, F j, Y'strtotime($regdate));?></td>
                            </tr>
                            <tr class="Light">
                                <td align="right">Name: </td>
                                <td><?php echo $fname?></td>
                            </tr>
                            <tr class="Dark">
                                <td align="right">Age: </td>
                                <td><?php echo $age?></td>
                            </tr>
                            <tr class="Light">
                                <td align="right">Gender: </td>
                                <td><?php echo $gender?></td>
                            </tr>
                        </table>
                <?php   if($user != $_SESSION['user'])
                        {
                            if(
    $userlevel 3)
                            {
    ?>
                            <br><table align="center" width="98%">
                            <tr>
                                <td><font size="-3">If you think there is copyrighted, inappropriate/offensive material or broken images on this page,  <a href="report.php">Click Here.</a></td></font>
                            </tr>
                            </table>
                    <?php    }
                        }
                }        
            } else {
                echo 
    "<p>There was an error when trying to connect to the database, please try again.</p>";
            }    
        } else {
            echo 
    "<p>No account exists with this name.</p>";
        }
        
    mysql_close();
    } else { 
    // line 170: error line
        
    header('Location: index.php');
        exit();
    }
    Might have to put this in an editor to see the layout more clearly, even though it isn't helping me, lol.
    Half way to nowhere

  2. #2
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Chicago
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That brace doesn't close anything. The code below closes the first if() block, so...
    PHP Code:
    } else {
                echo 
    "<p>There was an error when trying to connect to the database, please try again.</p>";
            } 
    Why's (Poignant) Guide to Ruby
    learn ruby with foxes, wizards, and chunky bacon

  3. #3
    SitePoint Addict
    Join Date
    May 2003
    Location
    sitepoint
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, not sure how/why I did that. Fixed that and now the page works fine.
    Half way to nowhere


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •