Hello,
I am trying to make it possible to have a user
select a date with two selects menus (one for the day and another
one for the month) what would trigger a query which will search for
rows where the choosen date is chronologically between a starting date
(column called "dep_from" and an ending date (column called "dep_to".
Those two columns are date formatted (0000-00-00).
I had a long look to the mysql documentation (date&time functions)
but I didn't find such a function.
I have found the "BETWEEN" command in the TEK-TIPS forum but what I've
done with it refuses to work properly.
Would someone be kind enough to tell me what is going wrong?
Here is what I did:
$choice1_dep = "2001-" . $dep_month_1 . "-" . $dep_day_1;
$db = mysql_connect("localhost", "xxxx", "xxxx"
mysql_select_db("xxxx",$db);
$sql="SELECT * FROM table WHERE ($choice1_dep BETWEEN dep_from AND dep_to)";
If someone has a better idea than "BETWEEN" (but not too complicated!!!) I wish
he tells me.
Have a good day.
I am trying to make it possible to have a user
select a date with two selects menus (one for the day and another
one for the month) what would trigger a query which will search for
rows where the choosen date is chronologically between a starting date
(column called "dep_from" and an ending date (column called "dep_to".
Those two columns are date formatted (0000-00-00).
I had a long look to the mysql documentation (date&time functions)
but I didn't find such a function.
I have found the "BETWEEN" command in the TEK-TIPS forum but what I've
done with it refuses to work properly.
Would someone be kind enough to tell me what is going wrong?
Here is what I did:
$choice1_dep = "2001-" . $dep_month_1 . "-" . $dep_day_1;
$db = mysql_connect("localhost", "xxxx", "xxxx"
mysql_select_db("xxxx",$db);
$sql="SELECT * FROM table WHERE ($choice1_dep BETWEEN dep_from AND dep_to)";
If someone has a better idea than "BETWEEN" (but not too complicated!!!) I wish
he tells me.
Have a good day.