prepare($sql_str); //接收表單輸入的資料 $updated_at = date("Y-m-d H:i:s"); $title = $_POST['title']; $content = $_POST['content']; $id = 1; $course = (empty($_POST['course'])) ? '0' : '1'; $daily = (empty($_POST['daily'])) ? '0' : '1'; $train = (empty($_POST['train'])) ? '0' : '1'; $isshow = (empty($_POST['isshow'])) ? '0' : '1'; $focus = (empty($_POST['focus'])) ? '0' : '1'; $hot = (empty($_POST['hot'])) ? '0' : '1'; $user = $_POST['user']; //設定準備好的$stmt物件中對應的參數值 $stmt->bindParam(':title' ,$title); $stmt->bindParam(':content' ,$content); $stmt->bindParam(':id' ,$id); $stmt->bindParam(':course' ,$course); $stmt->bindParam(':daily' ,$daily); $stmt->bindParam(':train' ,$train); $stmt->bindParam(':isshow' ,$isshow); $stmt->bindParam(':focus' ,$focus); $stmt->bindParam(':hot' ,$hot); $stmt->bindParam(':user' ,$user); $stmt->bindParam(':lastdate' ,$lastdate); //執行準備好的$stmt物件工作 $stmt->execute(); echo ""; }catch (PDOException $e ){ die("ERROR!!!: ". $e->getMessage()); } }