access_logテーブルにログがインサートされません。コードを記載しますので、修正箇所を教えていただけないでしょうか。
php
1<?php 2require_once('TableBase.php'); 3 4class CustomerTable extends TableBase{ 5 6 protected $name; 7 protected $list; 8 9 public function getList($id){ 10 try{ 11 if(isset($id) && $id !=''){ 12 $this->db->beginTransaction(); 13 $sql = $this->db->prepare("SELECT * FROM Customer left join Teletype on Customer.Telephone = Teletype.telephone left join board_status on Customer.SID = board_status.UserID WHERE SID=:sid order by Customer.SID limit 50"); 14 }else{ 15 $sql = $this->db->prepare("SELECT * FROM Customer where Customer.SID = 10 limit 50"); 16 17 } 18 $sql->execute(); 19 $sql->closeCursor(); 20 //access_logテーブルに参照者と日時を追加 21 $sql2 = "insert into access_log (id,accessor,ins_date) values(null,".$id.",now())"; 22 $stmt = $this->db->prepare($sql2); 23 $stmt->execute(); 24 $stmt->closeCursor(); 25 26 27 $this->db->commit(); 28 }catch(PDOException $e){ 29 //ロールバック 30 $this->db->rollBack(); 31 echo "失敗しました。" . $e->getMessage(); 32 } 33 34 } 35}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。