rondog Posted May 14, 2010 Share Posted May 14, 2010 I use this to make sure no two date ranges conflict since their can only be one featured event: $sql = mysql_query("SELECT * FROM de_featured_event WHERE '$startdate' BETWEEN start_date AND end_date OR '$enddate' BETWEEN start_date AND end_date") or die(mysql_error()); That works fine. What isn't working for me is when I am editing an event, I run the same query except I say where id != $_GET[id]: $sql = mysql_query("SELECT * FROM de_featured_event WHERE id != '".$_GET['id']."' AND '$startdate' BETWEEN start_date AND end_date OR '$enddate' BETWEEN start_date AND end_date") or die(mysql_error()); Basically I dont want it to select the date that I am editing. No matter what I do it always selects one row. That row being the one that is open hence the id != $_GET[id]. Any ideas? Link to comment https://forums.phpfreaks.com/topic/201708-help-with-this-sql-statement/ Share on other sites More sharing options...
Deoctor Posted May 14, 2010 Share Posted May 14, 2010 try removing the mysql_query infornt of it and echo the $sql now u ll get the query try running the same in the mysql.. i am sure this will show u what is wrong Link to comment https://forums.phpfreaks.com/topic/201708-help-with-this-sql-statement/#findComment-1058101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.