Hello people;
Anyone have any idea how to tackle this problem (quite new to all this):
I have a database with some dates in it, with whether they are free or not in boolean formate i.e. 1 for free and 0 for not free.
eg.
12/12/2006 1
13/12/2006 1
14/12/2006 0
15/12/2006 1
I want to be able to enter two dates, and loop from date 1 through to date 2 checking all the dates in between and see if they all = 1! and if not flag it to the user as being 0 and not free.
Any ideas would be helpful!
Thanks
PHP Loop
Moderator: General Moderators
Can't you do something like
?
No looping - you just pull the information directly out of the database. If no rows are returned, then the dates are all "1", if you get results, then it will return the dates with "0".
Code: Select all
SELECT date FROM t_dates WHERE date BETWEEN '$date_from' AND '$date_to' AND free=0
No looping - you just pull the information directly out of the database. If no rows are returned, then the dates are all "1", if you get results, then it will return the dates with "0".
-
b00ker_b0y
- Forum Newbie
- Posts: 10
- Joined: Thu Jun 22, 2006 7:16 am