Jump to content

A Little <=>+ help


MrCreeky

Recommended Posts

Hi,

 

I'm wanting to show a link if today's date is 14 days before an event. Here is what I came up with but none of it works.

 

<?php if date("D,M,Y"); < ($row_rs1_events['myedate']); echo (<a href="regs/<?php echo $row_rs1_events['regs']; ?>" target="_blank">Download Regs</a>); ?>

 

or

 

<?php
$countdown = "14";
if date("dS F Y"); <($countdown) + ($row_rs1_events['myedate']); 
print (<a href="regs/<?php echo $row_rs1_events['regs']; ?>" target="_blank">Download Regs</a>); 
?>

 

Could someone give me a push?

Link to comment
https://forums.phpfreaks.com/topic/125801-a-little-help/
Share on other sites

clean code!

 

<?php
$countdown = "14";
if(date("dS F Y") < ($countdown) + ($row_rs1_events['myedate']))
{
    print ("<a href=\"regs/{$row_rs1_events['regs']}\" target=\"_blank\">Download Regs</a>");
}
?>

 

Well formed, but won't work. You need to use unix timestamps if you want to do it with PHP alone.

Link to comment
https://forums.phpfreaks.com/topic/125801-a-little-help/#findComment-650570
Share on other sites

Hi,

 

Thanks for getting back to me. Yes, all the data is coming up from a mySQL database.

 

Tried this, don't get any errors but the page still shows all the links from the year and not just the ones with only 14 days to go before the event.

 

<?php
$unixtime = time();
$countdown = "14";
if(date("dS F Y",$unixtime) < ($countdown) + ($row_rs1_events['myedate']))
{
    print ("<a href=\"regs/{$row_rs1_events['regs']}\" target=\"_blank\">Download Regs</a>");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/125801-a-little-help/#findComment-650723
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.