You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
<?php
|
|
require_once('./conn.php');
|
|
if(isset($_POST['objName'])){
|
|
try{
|
|
|
|
$sql_str = "UPDATE contract_standard_contract set contract_no=:contract_no, updated_at=:updated_at where id = :id" ;
|
|
|
|
//執行$conn物件中的prepare()預處理器
|
|
$stmt = $conn->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 "<script>alert('更新成功!');window.location.href = './news.php' </script>";
|
|
|
|
|
|
|
|
}catch (PDOException $e ){
|
|
die("ERROR!!!: ". $e->getMessage());
|
|
}
|
|
}
|