Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. public function fetchVLTable() {
  2.         $stmtFetchVL = $this->con->prepare("SELECT * FROM vehicle2_login");
  3.         $stmtFetchVL->execute();
  4.         $cdate=date("m/d/Y");
  5.             foreach($stmtFetchVL as $row) {
  6.             $vl_id = $row['id'];
  7.             echo '<tr>
  8.             <td>'.$row['id'].'</td>
  9.             <td>'.$row['plate'].'</td>
  10.             <td>'.$row['status'].'</td>
  11.             <td>'.$row['name'].'</td>';
  12.             $datedb = $row['expiration_date'];
  13.             if($datedb == $cdate) {
  14.                 $stmtDeleteVL = $this->con->prepare("DELETE FROM vehicle2_login WHERE expiration_date = ?");
  15.                 $stmtDeleteVL->execute(array($cdate));
  16.             echo '<td>'.date("F j, Y g:i a",strtotime($row['time_login'])).'</td>';
  17.             }
  18.             elseif ($cdate != $datedb) {
  19.                 echo '<td>'.date("F j, Y g:i a",strtotime($row['time_login'])).'</td>';
  20.                 // echo "Date db != current date";
  21.             }else {
  22.                 echo '<td>'.date("F j, Y g:i a",strtotime($row['time_login'])).'</td>';
  23.             }
  24.            
  25.             echo'<td><a style="color:green;" href=update_vl.php?edit_vl='.$vl_id.'>Edit</a></td>
  26.             <td><a style="color:red;" href=delete_vl.php?delete_vl='.$vl_id.'>Delete</a></td>
  27.             </tr>';
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement