Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

foreach Using GLOBALS Variable

$
0
0
Hi peeps,
 
      I have this code here in a function.php file.
 
$row = mysqli_fetch_array(mysqli_query($con,"SELECT * FROM releases"));
$GLOBALS ['releaseids']=$row['id']; global $releaseids;
 
I then try & use this within a function
 
function postcontainer(){
global $releaseids;
foreach ($releaseids as $releaseid){
echo "this is the id";}
}}
 
 
Every time however, I keep getting 
 
 Invalid argument supplied for foreach() in...
 
This still applies too if it isn't put inside or outside of a function.
 
Very grateful
digiman 

Viewing all articles
Browse latest Browse all 13200

Trending Articles