Jump to content

array in loop help


MDanz

Recommended Posts

i have an array in the loop but it isn't building up with results.  i want it to check if the array exists, if not then create the array. Then in next loop it pushes a new value into the array.  Below isn't working?...

 


while($row=mysql_fetch_assoc($get));
{
$key = $row['keyword'];

$scope= $_SESSION['scope'];


		if (!is_array($scope)) {

		$scopenew = array($key);
		$_SESSION['scope'] = $scopenew;

                } else {

		$scopenew = array_push($scope, $key);
			$_SESSION['scope'] = $scopenew;	

}


}

Link to comment
https://forums.phpfreaks.com/topic/236979-array-in-loop-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.