Ok, I've got a quick question. I'm using PDO to communicated with a MySQL db. Using BETWEEN with two dates as the variable is easy:
$db->query("SELECT * FROM awesome WHERE date BETWEEN :start AND :end");
What I don't think is easy is when I have one date and two columns. This doesn't work, no matter how loudly I cuss:
$db->query("SELECT * FROM awesome WHERE :one_date BETWEEN start_col AND end_col");
Is there a way to use BETWEEN without reverting to something awful like...?
$db->query("SELECT * FROM awesome WHERE '$one_date' BETWEEN start_col AND end_col");
Or should I just stick to not using BETWEEN in this case?
$db->query("SELECT * FROM awesome WHERE start_col<=:one_date1 AND end_col>=:one_date2")
Thanks!