Reputation: 59
$codigo = $_GET['codigo'];
$propuser = mysqli_query($con,"SELECT propiedades.pnombre FROM propiedades INNER JOIN arriendos ON propiedades.pid=arriendos.propiedad WHERE arrendador='$codigo'");
the database have fields with dates like start: 2015-01-18 end 2015-06-18
How can i specify to search only if the fields are within range? thank you!
edit: the main goal is to display the info if today is between start and end date.
Upvotes: 2
Views: 99
Reputation: 2365
Using BETWEEN
is clean and understandable:
example on the WHERE
clause
WHERE propiedades BETWEEN TO_DATE ('2015-01-18', 'yyyy/mm/dd')
AND TO_DATE ('2015-06-18', 'yyyy/mm/dd')
TO_DATE
will convert into a proper format for your db.
Cheers.
Upvotes: 1