title: php mysql update 3rd column value if 1st column value > 2nd column value
body: <p>I am comparing <strong>1</strong>st [ <strong>Sent</strong> ]  &amp; <strong>2</strong>nd column [ <strong>Last Update Date</strong> ] values. if 1st column value is greater than 2nd column value , than i want to save the value "<strong>attempted</strong>" in 3rd column [ Attempted ].</p>
  
  <p><a href="https://i.stack.imgur.com/cCIB4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cCIB4.png" alt="enter image description here"></a></p>
  
  <pre><code>    &lt;table&gt; 
  &lt;tr&gt;           
  &lt;th class="table-header"&gt;Sent&lt;/th&gt;
  &lt;th class="table-header"&gt;Last Update Date&lt;/th&gt; 
  
  &lt;th class="table-header"&gt;Attempted&lt;/th&gt; 
  &lt;/tr&gt;
  
  &lt;?php
  if(!empty($orderrecords))
      {
        foreach($orderrecords as $k=&gt;$v)
        {  
  ?&gt;
  
  &lt;tr&gt;
  &lt;td&gt;&lt;?php echo $orderrecords[$k]["sent_date"]; ?&gt;&lt;/td&gt;         
  &lt;td&gt;&lt;?php echo $orderrecords[$k]["lud"]; ?&gt;&lt;/td&gt; 
  
  &lt;td&gt;
  &lt;?php 
  $orderrecords[$k]["sent_date"]= strtotime($orderrecords[$k]["sent_date"]);
  $orderrecords[$k]["lud"]=  strtotime($orderrecords[$k]["lud"]);
  
  $sqlecom = 'UPDATE table SET attempted = "attempted" WHERE $orderrecords[$k]["lud"] &lt; $orderrecords[$k]["sent_date"]';
  $db_handleecom = new DBController(); 
  $resultecom = $db_handleecom-&gt;executeUpdate($sqlecom); 
  
  
  echo $orderrecords[$k]["attempted"];
  ?&gt;
  
  &lt;/td&gt; 
  &lt;/tr&gt;
  
  &lt;?php
   }
   }
  ?&gt;  
  
  &lt;/table&gt;      
  </code></pre>
  
  <p><strong>update</strong> : I tried below code, but still 3rd column values are not saving in database.</p>
  
  <p></p>
  
  <pre><code>&lt;?php 
  
  $orderrecords[$k]["sent_date"]= strtotime($orderrecords[$k]["sent_date"]);
  $orderrecords[$k]["lud"]=  strtotime($orderrecords[$k]["lud"]);
  
  if ($orderrecords[$k]["lud"] &lt; $orderrecords[$k]["sent_date"])
      {
      $sqlecom = 'UPDATE table SET attempted = "attempted"
                 WHERE id = ' . $orderrecords[$k]['id'];
  
      $db_handleecom = new DBController(); 
      $resultecom = $db_handleecom-&gt;executeUpdate($sqlecom);
      //echo "attempted";
  } 
  
  echo $orderrecords[$k]["attempted"];
  
  ?&gt;
  </code></pre>
  
  <p><strong>Update 2</strong> : </p>
  
  <p>when i add below code on top of the file, than complete table disappears!!!! :</p>
  
  <pre><code>mysqli_report(MYSQLI_REPORT_ALL &amp; ~MYSQLI_REPORT_INDEX);
  </code></pre>
  
  <p>here is full code : <a href="https://pastebin.com/VwQSjgQ5" rel="nofollow noreferrer">https://pastebin.com/VwQSjgQ5</a></p>