Jump to content

Archived

This topic is now archived and is closed to further replies.

cyprus

Adding from/to dates on where select query

Recommended Posts

I have a series of checkboxes on a page/form which allows the user to dynamically build a WHERE statement.

$where = "WHERE GGroup IN ('$prodlist')";

Is it possible to add into the above a where condition to select records between two dates? Many thanks.

Share this post


Link to post
Share on other sites
something like
[code]
<?php
$from_date = "2006-01-01";
$to_date = "2006-09-24";
$query = "SELECT * FROM table WHERE date_added BETWEEN '".$from_date."' AND ".$to_date."'";
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.