// Your problem is on these two lines
while($current != $finalID)
{
$current = $everything[$counter];
You are in effect always comparing a row array ($current) to an array containing the array of the last row ($finalID is in other words no id, nor is it even the array of the last row.
If you inspect what those two contain using print_r, you should find something similar to this
$a1 = array(array('transactionID' => 1), array('transactionID' => 2 ),array('transactionID' => 4));
$lastId = array(array('transactionID' => 4));
if ($a1[2] == $lastId)
{
echo '$a1[2] == $lastId';
}
else
{
print_r($a1[2]);
echo ' is NOT the same as ';
print_r($lastId);
}
And why not simply
foreach ($everything as $row)
{
}