我正在根据名称的文本输入搜索用户名,如下所示:
// find users
$users = explode(',', $_POST['to']);
$user_id_list = array();
print_r($users);
foreach ($users as $user)
{
$db->sqlquery("SELECT `user_id` FROM `users` WHERE `username` LIKE ?", array("%$user%"));
$user_id = $db->fetch();
$user_id_list[] = $user_id['user_id'];
}
print_r($user_id_list);
但它似乎只找到第一个而不是第二个?难道我做错了什么?