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!
array_pushcorrectly. The first arg is the array and the 2nd arg is the value. 2nd, the returned value is the new number of elements in the array (basically acount($array). If you just want an array of user ids, see xbonez answer below