Jump to content

[SOLVED] SQL BETWEEN Problem


gerkintrigg

Recommended Posts

I'm using this code:

$avail_query="SELECT COUNT(*) as records FROM booking WHERE (start_date BETWEEN $week_start2 && $week_end2) || (end_date BETWEEN $week_start2 && $week_end2) || ($week_start2 BETWEEN start_date && end_date) || ($week_end2 BETWEEN start_date && end_date)";

to try to count SQL records, but it's not working. It's returning 0 rows, which is weird because it should be returning 3. however, I replaced the variables with values and tried it in PHPMyAdmin and there are no rows returned again.

 

Please help.

 

Thanks,

Neil

Link to comment
https://forums.phpfreaks.com/topic/43825-solved-sql-between-problem/
Share on other sites

Archived

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

×
×
  • Create New...

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.