こんにちは、クエリを使用してユーザー ID の配列を作成しています。別のクエリを使用して、最初のクエリから作成された配列にある user_id である特定のテーブルから選択したいと思います。WHERE 句で配列を使用するにはどうすればよいですか?
参考までに: $row_interest は配列です
私のコード:
//Grabs the user id's of the users that have the queried interest
$interest_search_query= "SELECT DISTINCT user_id FROM interests WHERE interest LIKE
'%".$search_term."%'";
$interest_search_result= mysqli_query($connect, $interest_search_query);
$row_interest= mysqli_fetch_array($interest_search_result);
//Grabs the user information with each user id
$search_query= "SELECT DISTINCT user_id, fname, lname, profile_pic, school FROM users
WHERE user_id IN $row_interest";
「WHERE user_id IN $row_interest」を試してみましたが、うまくいかないようです。私は何が間違っているのでしょうか?
ありがとう。