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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Simple IF Statement problem!

    Hi all,

    I have a very basic if statement, but I am receiving the error:

    Parse error: syntax error, unexpected '}', expecting ',' or ';' in /path/to/file/jobenquire.php on line 112

    However, I can't see anything wrong with the statement. There doesn't appear to be an extra } or anything. Can anyone tell me what I am overlooking?

    PHP Code:
    <?php 
      
    if (!empty($row['hours'])) {
          echo 
    $row['hours'];
            } else { 
    // This is line 112
        
    echo "Not Supplied"
        
    }
      
    ?>
    Many thanks,

    Greens85

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    238
    Thanks
    3
    Thanked 37 Times in 37 Posts
    PHP Code:
    echo "Not Supplied"
    ; has been missing at the end of the line.

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    try this;

    PHP Code:
    <?php 
      
    if (!empty($row['hours'])) {
           echo 
    $row['hours'];
      } else {
           echo 
    "Not Supplied";
      }
      
    ?>

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by angst View Post
    try this;

    PHP Code:
    <?php 
      
    if (!empty($row['hours'])) {
           echo 
    $row['hours'];
      } else {
           echo 
    "Not Supplied";
      }
      
    ?>
    Thats done the trick, thanks very much...

    I did actually try it with the ; after the not supplied, but I must have been missing something else!


  •  

    Posting Permissions

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