I have an table called user like this
id | user
1 | test
2 | test1
I have an query like this:
$arr = array(0 => 1 , 1=> 2);
$sql = "SELECT user
FROM user
WHERE id IN (".implode(',',$arr).")
ORDER BY id";
$gg = mysqli_query($conn, $sql);
if(!$gg) {
echo mysqli_error($conn);
} else {
while ($row = mysqli_fetch_array($gg)) {
print_r($row[0]);
}
}
Ouput always shows as testtest1
but i want it in array like
([0] => test, [1] => test1)
or even test,test1 is ok but it should work outside loop as well. Help appreciated.