Pętla mysql_fetch_assoc za pomocą foreach zamiast pętli while

Mam zapytanie mysql:

$result = mysql_query("my query");

Czy istnieje sposób na zrobienie czegoś takiego?

$results = mysql_fetch_assoc($result); // fetch the results

I zapętl ich za pomocą foreach zamiast klasycznych, podczas gdy:

foreach($results as $result){
   $result1 = $result->result1;
   $result2 = $result->result2;
}

Ty

questionAnswers(2)

yourAnswerToTheQuestion