Php – Comparing a value with previous row in a while loop

php

I'm a newbie in PHP, so forgive me for a basic question.

In a While statement, is there a way to know if a value in a row is equal to a value in the previous row?

Best Solution

Just store it:

$get = mysql_query("...");
$previous = '';
while ($row = mysql_fetch_assoc($get)) {
  $current = $row['...'];
  if ($current == $previous) {
    // do stuff
  }
  $previous = $current;
}