Need to push values of an array as like (‘1′,’2’,’3’……..) in a $variable. I have a while loop from where I am getting the values 1,2,3…. I am doing like this
while ($record = mysql_fetch_array($query, MYSQL_ASSOC)) {
$users_id = $record['user_id'];
$uid = array_push($users_id, ',');
}
I need these values as a String in a variable, then I will use explode function to remove ‘,’ and use it according to my need. Please anyone can help me in this.. Thanks!
Adding them to a string and exploding it will give you an array of the values. You can just directly push them to an array