Jump to content

Recommended Posts

Hi everyone, Im a bit dumbfounded here, Is it possible to have an IF statement WITHIN an IF statement? I have a variable being called if the table isnt null, I then need another statement to show if date is older than 14 days, does this make sense?

 

At the moment I have

<?php 

if (@$row_rsworksorders1['intraartapproval'] != "") {
?>
                    <?php echo KT_FormatForList(date('d/m/Y',strtotime($row_rsworksorders1['intraartapproval'])), 20); ?>
                    <?php 

} else { ?>
                 
  <?php } 

?>

 

I need this line...

<?php echo KT_FormatForList(date('d/m/Y',strtotime($row_rsworksorders1['intraartapproval'])), 20); ?>

 

to show

<span style="color:#ff0000;"><?php echo KT_FormatForList(date('d/m/Y',strtotime($row_rsworksorders1['intraartapproval'])), 20); ?></span>

If the date is older than 14 days...

Link to comment
https://forums.phpfreaks.com/topic/202739-if-statement-within-an-if-statement/
Share on other sites

Of course, you can nest as many if statements as necessary.

 

echo ($t = strtotime($row_rsworksorders1['intraartapproval'])) < time() - 60*60*24*14 ? '<span style="color:#ff0000;">' . KT_FormatForList(date('d/m/Y',$t), 20) . '</span>' : KT_FormatForList(date('d/m/Y',$t), 20);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.