nasıl bir önceki ile şimdiki resultset'de değerini karşılaştırmak için?

0 Cevap php

Kod parçacığını bir göz atınız

while ($rslt = fetch_array($result))
   {

     //$row++;
     if (bccomp ($row, $row_limit, 0) != 1)
       {
         /*HEADER*/            

         if ($row == 0)
           {
             foreach ($_SESSION['market']['data'] as $title => $field)
               {
                 //Output Header Cell

                 //$title++;
                 $worksheet->write ($row, $col, title,$formatHeader);                     
                   //Advance Column
                 $col++;
                 }
               }

             //Reset Column Position
             $col = 0;

             //Advance Row
              $row++;
           }

         /*BODY*/
         foreach ($_SESSION['market']['data'] as $title => $field)
           {


             //Output Body Cell
             $worksheet->write ($row, $col, $rslt[$field], $formatNormal);

             //Advance Column
             $col++;
           }

         //Reset Column Position
         $col = 0;

         //Advance Row
         $row++;
       }

   }

its working completly fine and i am happy with it.but now the requirement is: in each row's 0th column there is a name,and with respect to that name there are other fields,now what i want to do is to compare each row's 0th column,problem is how to store previous row's 0th column.than logic is like ($rslt['name']===$rslt[//previous column name]). Please sort me out .

0 Cevap