secretsquirrel
Programmer
i'm trying to retrieve a column out of a mysql table.
my problem is how to get past the first row of the result set.
at the moment, if i display the results of the function below i get...
Location: London
Location:
but i want it to look like...
Location: London
Location: Paris
----------------------------------------
function getLocations($username)
{
if(!($conn = db_connect()))
return false;
$result = mysql_query("SELECT location FROM myTable"
;
if(!$result)
return false;
$num_results = mysql_num_rows($result);
$row = mysql_fetch_array($result);
for($count = 0; $count < $num_results; $count++)
{
print "<p>Location: $row[$count]";
}
}
----------------------------------------
can anyone point out where i'm going wrong, please?
thanks in advance,
ss...
my problem is how to get past the first row of the result set.
at the moment, if i display the results of the function below i get...
Location: London
Location:
but i want it to look like...
Location: London
Location: Paris
----------------------------------------
function getLocations($username)
{
if(!($conn = db_connect()))
return false;
$result = mysql_query("SELECT location FROM myTable"
if(!$result)
return false;
$num_results = mysql_num_rows($result);
$row = mysql_fetch_array($result);
for($count = 0; $count < $num_results; $count++)
{
print "<p>Location: $row[$count]";
}
}
----------------------------------------
can anyone point out where i'm going wrong, please?
thanks in advance,
ss...