use $db->sql_in_set also line 413 over this
https://wiki.phpbb.com/Database_Abstraction_Layer#sql_in_set