Jump to content

help with arrays


EchoFool

Recommended Posts

Hey im slightly stuck with an array im trying to while loop as i think i got it slightly wrong =/

 

The while loop is built with this:

<?php
While loop etc {
   $a[] = $row['ID'];  //contructing the array
}
?>

 

 

Then i tried this to while loop it:

<?php
While($a){
$Select = mysql_query("SELECT CityID FROM mitable WHERE ID='$a' GROUP BY CityID")
Or die(mysql_error());
$row = mysql_fetch_assoc($Select);
$CityID = $row['CityID'];
Echo $CityID.'<br>';
// rest of while loop here unrelated to it
}
?>

 

Can you see where i went wrong?

Link to comment
https://forums.phpfreaks.com/topic/122397-help-with-arrays/
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.