News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

crazy mySQL question

Started by Aquilo, November 01, 2003, 02:59:01 PM

Previous topic - Next topic

Aquilo

is it possible to do this in mySQL?
((month)(year)) != ({$month.$year})

what I would like to do is make ((month)(year)) like 112003 and compare it to ({$month.$year}) to see that there not the same.

is this actually possible?

Aquilo

never mind! this would be good to know but all I had to do was match it like I did the days and months and the year feel in place!

Aquilo

ok still not working! :(

would anyone have a sugestion on how to make this right? it's the year that is giving me a headach of I leave the year out it returns next years dates and with it, it will not return any thing if asked to get past the end of this year!

thanks for any suggestions!


$weeks   = 11;
$f   = mktime(0,0,0,$month, $day+(7*$weeks), $year);
$fday   = date('d',$f);
$fmonth   = date('m',$f);
$fyear   = date('Y',$f);

$holidays_query = mysql_query("
   SELECT title, day, month, year
   FROM {$db_prefix}calendar_holiday
   WHERE (month BETWEEN '{$month}' AND '{$fmonth}')
   AND (day BETWEEN '{$day}' AND '{$fday}')
   AND (year BETWEEN '{$year}' AND '{$fyear}')
   ORDER BY day DESC, month DESC, year DESC");

[Unknown]

Soemthing like...

WHERE CONCAT(month, year) != '{$month.$year}'

But why do you want to do that?

-[Unknown]

Aquilo

I want to select the holidays within a time frame from the database.

Advertisement: