:::

9-3 上課範例:save_class.php

<?php
require_once "header.php";


$op=isset($_REQUEST['op'])?$_REQUEST['op']:"";
$class_sn=isset($_REQUEST['class_sn'])?intval($_REQUEST['class_sn']):"";

if($op=="update"){
  //SQL更新語法
  $sql="update tncomu_class set `seme`='{$_POST['seme']}', `subject`='{$_POST['subject']}', `class_name`='{$_POST['class_name']}', `teacher`='{$_POST['teacher']}', `passwd`='{$_POST['passwd']}', `access`='{$_POST['access']}' where class_sn='$class_sn'";
}else{
  //SQL新增語法
  $sql="insert into tncomu_class (`seme`, `subject`, `class_name`, `teacher`, `passwd`, `access`) values('{$_POST['seme']}' , '{$_POST['subject']}' , '{$_POST['class_name']}' , '{$_POST['teacher']}' , '{$_POST['passwd']}' , '{$_POST['access']}')";
}


//執行SQL語法
mysql_query($sql) or die("無法執行:".mysql_error());

//執行完轉向
header("location: index.php");
?>

:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D541%26tbsn%3D20

書籍目錄

展開 | 闔起

線上使用者

71人線上 (15人在瀏覽線上書籍)

會員: 0

訪客: 71

更多…