if statement not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevinwinters
Forum Newbie
Posts: 20
Joined: Wed Jan 06, 2010 8:31 pm

if statement not working

Post by kevinwinters »

Hi, I am looping through a recordset and can't understand why this row always displays "n/a" even though some of the "date_sold" fields actually contain a date.

If I remove the "if" clause and simply display the row, I get the date_sold dates to display when they occur. What could I be doing wrong?

Code: Select all

 
 
if($row->date_sold = '0000-00-00 00:00:00'){
        $sHtml .= '<td nowrap>n/a</td>';
    } else {  
        $sHtml .= '<td nowrap>'.Format_Date($row->date_sold).'</td>';
    }  
 
 
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: if statement not working

Post by papa »

if($row->date_sold == '0000-00-00 00:00:00')
kevinwinters
Forum Newbie
Posts: 20
Joined: Wed Jan 06, 2010 8:31 pm

Re: if statement not working

Post by kevinwinters »

yes, of course, thank you. keep getting stuck on this due to my ASP experience.
Post Reply