I am getting a result set back from a query. I am wanting to pass the elements to an array. I am using a while loop but the array is not adding all elements just the last one in the query. Am I doing something wrong?
e.g code
$result=array();
$db->query("SELECT name FROM fruit");
while($x= $db->next_record())
{
$result=($x['name']);
}
function next_record() {
$this-CurrentRecord = mysql_fetch_array($this->result);
return $this->CurrentRecord;
}
So if the query returned e.g oranges and apples, I want $result to store both results.
Thx