Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Else help [php]

  1. #1
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post

    Else help [php]

    This gives me an error: Parse error: syntax error, unexpected '}' in /home/frazierf/public_html/forum/rep.php on line 37



    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body> <?php require_once("config.php"); ?>
    <?php
    $reputation 
    $retreive_from_database;
    if (
    $reputation != 10) {

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />";

    if(
    $reputation 11) {

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />";


    if(
    $reputation 12) {

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />";




    }
    else {
    }
    }

    else {
                
    }
    }else

    }
    }else
    }
    }


    ?>
     

    </body>
    </html>


    How do I fix it?

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    You have extra closing braces. Maybe you wanted like this :
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Untitled Document</title> 
    </head> 

    <body> <?php require_once("config.php"); ?> 
    <?php 
    $reputation 
    $retreive_from_database
    if (
    $reputation != 10) { 

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />"

    if(
    $reputation 11) { 

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />"


    if(
    $reputation 12) { 

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />"





    else { 



    else { 
                 

    else 
    {} 
    else 
    {}

    }

    ?> 
      

    </body> 
    </html>
    See if it helps


  •  

    Posting Permissions

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