Eliminating array variables from select query result

Can somebody help with this please.

I have a variable $uniqueid which is an array.

I need a select statement to do this:
select bookingid, datebooked from bedsbooked where datebooked > today and booking id does not equal any of the values in the variable $uniqueid, ordered by datebooked

Here is an example of how the mysql table is set up.


        bookingid    datebooked
         73 	2010-10-15
		73 	2010-10-14 	
	 	74 	2010-09-25 	
		75 	2010-08-24 	
	 	76 	2010-08-18 	
	 	77 	2010-08-18

I realise now that there are better ways to structure the table which would simplyfy what I am trying to do, but for the time being am not in a position to make those changes.

Thanks for introducing me to implode function. Not used that one before.

Couldn’t get it to work exactly as you have set it out, but this does work

$arr = implode(" or ", $values) ;

"select bookingid, datebooked 
from bhsbedsbooked 
where datebooked > '$todaydate' 
and bookingid != '$arr'"

This is largely an sql question.


$values = array(73,74,75);

$arr = implode(",", $values) ;

"select bookingid, datebooked 
FROM edsbooked 
WHERE datebooked > today 
AND booking id NOT IN ('. $arr .');"

NOT tested, and also depends upon which version of mysql you are using.