$stack1 = array();
for($i = 0; $i < sizeof($stack1); $i++)
{
$data1[$i] = mysql_query("SELECT Co FROM levels WHERE IDLevel='1' AND N='$stack1[$i]' AND IDEmotion='1' ") or die(mysql_error());
$d1[$i]=mysql_fetch_array($data1[$i]);
$_SESSION [$i]['G1']=$d1[$i]['Co'];
}

When I echo $_SESSION [$i], it prints correctly but it gives the following notice:

( ! ) Notice: Unknown: Skipping numeric key 0 in Unknown on line 0

( ! ) Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

( ! ) Notice: Unknown: Skipping numeric key 2 in Unknown on line 0

I do not know why. Is there any idea?

You must have copied something wrong

<?php
$stack1 = array();
echo sizeof($stack1);
// will be 0 

for($i = 0; $i < sizeof($stack1); $i++)
{
  //this will not happen at all
  echo $i; 
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.