10-1
上課範例:index.php
03 | require_once "header.php" ; |
06 | $op =isset( $_REQUEST [ 'op' ])? $_REQUEST [ 'op' ]: "" ; |
07 | $class_sn =isset( $_REQUEST [ 'class_sn' ])? intval ( $_REQUEST [ 'class_sn' ]): "" ; |
12 | delet_class( $class_sn ); |
24 | function delet_class( $class_sn =null){ |
27 | $sql = "delete from `tncomu_class` where class_sn='{$class_sn}'" ; |
30 | mysql_query( $sql ) or die ( "無法執行:" .mysql_error()); |
33 | header( "location: index.php" ); |
39 | $sql = "select * from `tncomu_class` order by seme desc, subject" ; |
42 | $result = mysql_query( $sql ) or die ( "無法執行:" .mysql_error()); |
46 | function delete_func(sn){ |
47 | var sure = window.confirm( '確定要刪除此資料?' ); |
49 | location.href= 'index.php?op=delete&class_sn=' + sn; |
55 | while ( $data =mysql_fetch_assoc( $result )){ |
58 | <td>{ $data [ 'class_sn' ]}</td> |
59 | <td>{ $data [ 'seme' ]}</td> |
60 | <td>{ $data [ 'subject' ]}</td> |
61 | <td>{ $data [ 'class_name' ]}</td> |
62 | <td>{ $data [ 'teacher' ]}</td> |
63 | <td>{ $data [ 'passwd' ]}</td> |
64 | <td>{ $data [ 'access' ]}</td> |
65 | <td><a href= 'java_script:delete_func({$data[' class_sn ']})' >刪除</a> | <a href= 'add_class.php?class_sn={$data[' class_sn ']}&op=edit' >編輯</a></td> |