php - One Select statement for criteria of one column with multiple values -


i want make sql select statement selects multiple rows based on value of 1 column, have list of valid values match rows want select.

specifically, have list of user ids. want select entire row every row has user id in list (this list in php, , i'm making sql calls there).

my code far, looks this:

$list_of_ids = array(1, 5, 7, 23);//list of user ids want select. $query = sprintf("select * users user_id=?????", ????); 

how do this?

$ids = implode(',',$list_of_ids); $query = sprintf("select * users user_id in ($ids)"); 

Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -