hello all (first time posting for this newbie)
lets say i have a query that looks something like this:
SELECT whatever FROM myColors WHERE color IN ('red', 'green', blue', 'purple')
i would like to be able to use bind_param to access this query, something like:
sql: SELECT whatever FROM myColors WHERE color IN (?)
$my_color_array = ('red', 'green', blue', 'purple');
$my_statement->bind_param('s' , $my_color_array );
but i am unable to determine what "syntax" the bind_param needs to pass an array as a single value into the subquery "IN" statement.
any ideas?
i did get it to work this way, but it seems pretty low-tech since the array size cannot vary:
sql: SELECT whatever FROM myColors WHERE color IN (?,?,?,?)
$my_statement->bind_param
('ssss'
, $my_color_array[0]
,$my_color_array[1]
, $my_color_array[2]
, $my_color_array[3]
);
thanks in advance,
mark