I want to store ids in database like this 1,2,3,4,5 in one field from a while loop.
how can i do this.
I am trying this way.
$array = array();
while($row=mysqli_fetch_assoc($result)){
$array[] = array($row['id']);
}
$query = mysqli_query($connection,"INSERT INTO temp (temp) VALUES('$array')");
print_r($array);
This is showing error Array to string conversion and value as Array is inserted in database.
Please see and suggest any possible way to do this.
Thanks.
serialize($array)to convert into string, and thenunserialize($string)to transform it back into an array.