giraffemedia Posted August 18, 2008 Share Posted August 18, 2008 Hi, is it possible to select rows from mysql that equal a number or less, but not anything over that number? I have a table below and would like to select all the bf_id_number rows which have 61 but not 62 in the issue_number column. If any row does have a number 62 in them, ignore all rows from that bf_id_number. table3 - issues_booked issue_id issue_number bf_id_number 1 60 2 2 61 2 3 62 2 4 60 1 5 61 1 6 59 3 7 60 3 8 61 3 Is it better to create arrays for each bf_id_number first and then search for all rows that have 61 as the last number? I have something like this at the moment: $issue = 61; $booking_query = ("SELECT DISTINCT(bf_id_number) FROM issues_booked WHERE issue_number <= '$issue' ORDER BY bf_id_number ASC") or die(0); Need help asap on this one. Regards James Link to comment https://forums.phpfreaks.com/topic/120191-solved-mysql-and-array-query/ Share on other sites More sharing options...
giraffemedia Posted August 18, 2008 Author Share Posted August 18, 2008 Anyone? I need to get this sorted asap. Thanks James Link to comment https://forums.phpfreaks.com/topic/120191-solved-mysql-and-array-query/#findComment-619246 Share on other sites More sharing options...
Mchl Posted August 18, 2008 Share Posted August 18, 2008 Remove quotes from around $issue SELECT DISTINCT(bf_id_number) FROM issues_booked WHERE issue_number <= $issue ORDER BY bf_id_number ASC Link to comment https://forums.phpfreaks.com/topic/120191-solved-mysql-and-array-query/#findComment-619254 Share on other sites More sharing options...
giraffemedia Posted August 19, 2008 Author Share Posted August 19, 2008 Hi Mchl that doesn't make a difference - i've tried that already. James Link to comment https://forums.phpfreaks.com/topic/120191-solved-mysql-and-array-query/#findComment-619866 Share on other sites More sharing options...
giraffemedia Posted August 19, 2008 Author Share Posted August 19, 2008 I've managed to work it out by using the php end function to find the last number in the array and if it was equal to the issue number to create an array of booking form numbers. I then used this array in the mysql query and it's working fine. James Link to comment https://forums.phpfreaks.com/topic/120191-solved-mysql-and-array-query/#findComment-619888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.