Hi,
How do I populate a flat array through a loop type sequence.
So far I have a basic query resulting in a few rows of data.
$sSql = 'SELECT suburb'
. ' FROM locations'
. ' WHERE locations.postc ode = '.$postcode
. ' LIMIT 0 , 40;';
$result = mysql_query($sS ql) or die('Query failed: ' . mysql_error());
$numberOfRows = mysql_num_rows( $result);
$i = 0;
$SuburbArray = array(); // define the array
if ($numberOfRows> 0) {
while ($i<$numberOfRo ws) {
echo mysql_result($r esult,$i,"subur b");
$thisSuburb = mysql_result($r esult,$i,"subur b");
// I need to add each value to array here.
$i++;
}
}
thank you.
How do I populate a flat array through a loop type sequence.
So far I have a basic query resulting in a few rows of data.
$sSql = 'SELECT suburb'
. ' FROM locations'
. ' WHERE locations.postc ode = '.$postcode
. ' LIMIT 0 , 40;';
$result = mysql_query($sS ql) or die('Query failed: ' . mysql_error());
$numberOfRows = mysql_num_rows( $result);
$i = 0;
$SuburbArray = array(); // define the array
if ($numberOfRows> 0) {
while ($i<$numberOfRo ws) {
echo mysql_result($r esult,$i,"subur b");
$thisSuburb = mysql_result($r esult,$i,"subur b");
// I need to add each value to array here.
$i++;
}
}
thank you.
Comment