tags:

views:

84

answers:

1

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?

+5  A: 

Just store it:

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