0

Hi there everyone,

Im looking for a solution regarding a project im involved with which needs to run a script that search's between dates.

Im running a table like this example:

ID - date_begin - date_end - price
1 01-01-2009 31-01-2009 1€
2 01-02-2009 14-02-2009 2€
3 15-02-2009 27-03-2009 3€
....

And i have a search box in PHP which allows me to search a date like 15-01-2009.

But I need to search 15-01-2009 and return this date interval (1 01-01-2009 31-01-2009 1€).

Is there any query to make this work?

Thanks in advance

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by harry_watson
0

Hi there everyone,

Im looking for a solution regarding a project im involved with which needs to run a script that search's between dates.

Im running a table like this example:

ID - date_begin - date_end - price
1 01-01-2009 31-01-2009 1€
2 01-02-2009 14-02-2009 2€
3 15-02-2009 27-03-2009 3€
....

And i have a search box in PHP which allows me to search a date like 15-01-2009.

But I need to search 15-01-2009 and return this date interval (1 01-01-2009 31-01-2009 1€).

Is there any query to make this work?

Thanks in advance

For future reference:
SELECT *
FROM fsdhfs
WHERE date_begin <= "2009-01-15"
AND date_end >= "2009-01-15"
LIMIT 0 , 30

0

Or This code works well with lots of conditions to meet

$sql = "SELECT * FROM artists_details LEFT JOIN attendance ON attendance.record_id AND attendance.visit_date >= '".$from_date."' AND attendance.visit_date <= '".$to_date."' WHERE artists_details.youth='youth' AND attendance.artist_id=artists_details.artist_id AND artists_details.outreach='outreach'";
//echo $sql;
$result4=mysql_query($sql);
$num_rows_y = mysql_num_rows($result4);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.