array looping
Posted: Mon Dec 10, 2007 9:04 am
i have a query from which i gather 3 arrays
if i need to display the above values,
I know that i can display the values in the while loop itself, but i wanted in an array. I am struck, help me out
Code: Select all
while($fetch = mysql_fetch_array)
{
$name[] = $fetch['name'];
$id[] = $fetch['id'];
$address[] = $fetch['address'];
$image[] = $fetch['image'];
}Code: Select all
echo $count($id) // not returning 0 even though there are no ids
var_dump is giving: array(1) { [0]=> NULL }
if(count($id)>0)
{
for($i=0; $i<count($id); $i++)
{
echo $name[$i];
echo $address[$i];
echo $image[$i];
}
}