<?
  include 'include/db.php';
  include 'include/connect.php';
  //$today = date("m/d/Y");
  mysql_query("BEGIN");
  $s = $db->findByPK('tbtrip','trip_ex','0')->execute();


  // $today = date("d-m-Y");
  $today = date("Y-m-d");

  while($aa = mysql_fetch_assoc($s)){


    $head_date = $aa['trip_date_go'];
    $timestampss = strtotime($head_date);
    $tripdate = date('Y-m-d', $timestampss);

 // $tripdate = $aa['trip_date_go'];

if($today >= $tripdate){
      $data['trip_ex'] = '1';
      $tup = $db->update('tbtrip',$data,'trip_id',$aa['trip_id']);

      if($tup){
        mysql_query("COMMIT");
        echo 'ได้';
      } else {
        mysql_query("ROLLBACK");
        echo "พัง";
      }

}
  }

?>