$child= array();
$i = 0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$child[i] = $row['userId'];
$i++;
}
$i = 0;
while($i<=5)
{
echo $child[i];
$i++;
}
It is printing same value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are using
ifor the array index instead of$i:This should be
$child[$i]. Because theiin$child[i]is interpreted as a constant (value of constantiis used as index) or if there is no such constant as string. You can get a variable/value dump withvar_dump.