flemingmike Posted September 24, 2010 Share Posted September 24, 2010 is this a proper way of entering this? $result = mysql_query("SELECT * FROM jobs WHERE id2 >= '$startdate' AND id2 < '$enddate' ORDER BY id"); Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/ Share on other sites More sharing options...
Pikachu2000 Posted September 24, 2010 Share Posted September 24, 2010 BETWEEN . . . AND . . . Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115183 Share on other sites More sharing options...
chintansshah Posted September 24, 2010 Share Posted September 24, 2010 use belwo query $result = mysql_query("SELECT * FROM jobs WHERE id2 BETWEEN '".$startdate."' AND '".$enddate,"' ORDER BY id"); Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115194 Share on other sites More sharing options...
flemingmike Posted September 24, 2010 Author Share Posted September 24, 2010 is it possible to also add in WHERE status = '$status' so something like $result = mysql_query("SELECT * FROM jobs WHERE status = '$status' WHERE id2 BETWEEN '".$startdate."' AND '".$enddate,"' ORDER BY id"); Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115207 Share on other sites More sharing options...
flemingmike Posted September 24, 2010 Author Share Posted September 24, 2010 i currently have this, but no results show $result = mysql_query("SELECT * FROM jobs WHERE (id2 BETWEEN '$startdate' AND '$enddate') AND (status = '*') ORDER BY id"); Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115210 Share on other sites More sharing options...
flemingmike Posted September 24, 2010 Author Share Posted September 24, 2010 my status='*' is actually status='$poststatus' i have it working, i just dont know how to show all statuses. i tried *, but no luck Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115216 Share on other sites More sharing options...
litebearer Posted September 24, 2010 Share Posted September 24, 2010 if you do NOT use the AND "status = " it will show all. use the "status = " to limit the status to cetain ones Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115221 Share on other sites More sharing options...
flemingmike Posted September 24, 2010 Author Share Posted September 24, 2010 what can i put to show everything though? i have different links that will set $poststatus one of the links is display all. so what can i put in the status=' ' to make it show all statuses? Link to comment https://forums.phpfreaks.com/topic/214299-select-where-id-is-between-2-numbers/#findComment-1115222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.