Jump to content

Archived

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

mark s

Wrong Results...

Recommended Posts

I'm a noobie working with mysql.

 

I'm running the following code on my database,

its to hopefully show results that are.

 

Basically New listings, but if today has past not to be listed.

1. So New listings no older than 14 days.

2. If the New listing is older than today dont show.

 

cal -stamp = Date Entered.

cal_event = Event date

 

In laymans terms i'm trying to result a query like this,

 

Find all (cal-stamp) records that are not older than 14days

BUT...... out of those results,

if (cal_event) is older than today then dont show.

 

$query =( "SELECT 'cal_stamp' ,`cal_event` , `cal_cat` , `cal_desc` , `cal_link`
FROM `calendar` 
WHERE `cal_stamp` <= '$days14'
AND `cal_event`  >= '$today'
ORDER BY `cal_event` ASC ");

 

I found this snipit to work the date + 14days

and the todays date.

(they do run in my code above my sql and seem to be doing the job.

$days14 = strftime ("%Y-%m-%d", strtotime("+14 day"));
$today= strftime ("%Y-%m-%d");

 

Can anyone help?

 

i need to resolve the between dates i think?

 

Help or guidence apreciated thanks mark.

Thanks Mark.

Share this post


Link to post
Share on other sites

Now i realise that my 14 days isnt doing as I expected?

 

Yes its listing all the cal_stamp dates and beond todays date :(

I dont want it listing when today passes.

 

I need to hook up on some kind of a date range ?

 

Is there a sql way to do this?

 

I havent had any luck with

 

Date_sub

 

 

any help?

Share this post


Link to post
Share on other sites

More info can be found here, Click Me

 

Still tring to resolve the problem.

 

humm....

 

Moderators feel free to close this topic.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

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.