I have a query which fetches distinct user ids and I am trying to convert it into a comma separated string which I can pass into another sql query having IN in WHERE clause. But I am getting an error saying array to string conversion.
$qry0="SELECT DISTINCT id FROM users ";
$res0=getData($qry0);
while($row0=mysqli_fetch_array($res0))
{
$data0 = $row0['id'];
}
And I'm trying to convert it as string like this:
$array = explode(",", $data0);
and pass it to another
$qry="SELECT * FROM login WHERE clientid IN(".$array.") ";
explodecreates an array. whereimplodecreates a string ... an SQL query requires a string, not an array.