im having trouble with between dates.. when i run this with mySQL its working properly but when i insert this in php its not working..im searching but cant get any results.. thanks.
this is working fine.
but when i add the between -.- nothing happensSELECT * FROM guest_info where room_type = '$mode' and check_in = '$check_in' and check_out= '$check_out';
thanksSELECT * FROM guest_info where room_type = '$mode' and check_in = '$check_in' and check_out= '$check_out' between '$check_in' AND '$check_out';![]()
This is an example using between
Code:Where Stu_Dob Between '1984-01-01 00:00:00' And '1986-1-1 00:00:00';
just a drop of dew in the morning
( loop while (= x true) do (x) )
i've seen that example on web and tried that but unfortunately.. its not working lol
i dont know why when i add the "BETWEEN" its as if its not reading my queryim using the YYYY-MM-DD format
you must match the date format when 'select and insert' query, format must be the same
see format of date in php. you can customize it as you want
PHP: date - Manual
just a drop of dew in the morning
( loop while (= x true) do (x) )
im using sql and php isame format YYYY-MM-DD
I need to retrieve the records which are between the selected days(TWO dates are of two different fields)
You have to retrieve two of dates before
$first_date; //date from your database field
$second_date; //date from your database field
The following code is way to use between.
Code:SELECT * FROM your_table WHERE your_field BETWEEN '$first_date' AND '$second_date'
just a drop of dew in the morning
( loop while (= x true) do (x) )
thats not working with php....
my question is when i insert the "BETWEEN" the query is not working -.- i tried to search on google with this issue but i cannot find any answerthis is frustrating...
Do you have it set to print out an error if the querry fails? If so is it giving you one? If it is not set to give an error than do this
let us know the error or if it dose not return one after adding the or die, let us know. This will help us to find the problemCode:$query = "select BLAHAHAHAHAHAHAHAHA"; // whatever your query was
$run = mysql_querry($query)or die(mysql_error());// or die mysql_error() will do just as it sounds return an error if a problem occurs.
I scratched my head long and hard trying to figure out how to do this and what I came up with was this:
This checks to see if the date you selected is in the calendar or not. Hopefully that is what you are after...Code:SELECT whatever FROM calendar WHERE (':laterdate' > check_in) AND (':earlierdate' < check_out)
Well, in that second query, you don't have anything to be checked to see if it's between $check_in and $check_out. Are you trying to see if the current date is between those two values?
Code:SELECT * FROM guest_info WHERE room_type = '$mode' AND check_in = '$check_in' AND check_out= '$check_out' AND CURDATE() BETWEEN '$check_in' AND '$check_out';
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks