Jump to content

[SOLVED] Mysql and array query


giraffemedia

Recommended Posts

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

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

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.