Jump to content


Photo

Wrong Results...


  • This topic is locked This topic is locked
2 replies to this topic

#1 mark s

mark s
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 09 October 2005 - 04:02 PM

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.

#2 mark s

mark s
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 09 October 2005 - 08:12 PM

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?

#3 mark s

mark s
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 10 October 2005 - 03:47 PM

More info can be found here, Click Me

Still tring to resolve the problem.

humm....

Moderators feel free to close this topic.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users