Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2010, 01:45 PM   PM User | #1
greens85
Regular Coder

 
Join Date: Sep 2007
Posts: 809
Thanks: 5
Thanked 2 Times in 2 Posts
greens85 is an unknown quantity at this point
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
greens85 is offline   Reply With Quote
Old 02-24-2010, 01:50 PM   PM User | #2
SKDevelopment
Regular Coder

 
Join Date: Mar 2006
Posts: 238
Thanks: 3
Thanked 37 Times in 37 Posts
SKDevelopment has a little shameless behaviour in the past
PHP Code:
echo "Not Supplied"
; has been missing at the end of the line.
__________________
PHP Programmer
SKDevelopment is offline   Reply With Quote
Old 02-24-2010, 01:50 PM   PM User | #3
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
try this;

PHP Code:
<?php 
  
if (!empty($row['hours'])) {
       echo 
$row['hours'];
  } else {
       echo 
"Not Supplied";
  }
  
?>
angst is offline   Reply With Quote
Old 02-24-2010, 02:03 PM   PM User | #4
greens85
Regular Coder

 
Join Date: Sep 2007
Posts: 809
Thanks: 5
Thanked 2 Times in 2 Posts
greens85 is an unknown quantity at this point
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!
greens85 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:45 PM.


Advertisement
Log in to turn off these ads.