I have one SQL query and the results are retrieved using;
$result = mysql_query($query);
And the results are printed using;
while($row = mysql_fetch_array($result)){
echo $row['column']."<br>";
}
I want to store entire $row['column'] into an array. For that, the above code can be replaced by;
$my_array[] = "";
while($row = mysql_fetch_array($result)){
echo $row['column']."<br>";
$my_array[] = $row['column'];
}
But here, the while loop is executed. Is there any other efficient / better method, avoiding loops?
select column from table? This way, you already have it in an array. Of course it's going to be an associate array.