📄 class_edit.php
字号:
<?php header("Content-Type: text/html; charset=UTF8");?><?php putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8");?><?php $conn=oci_connect("zhangsan","p06123456","//127.0.0.1/XE"); if(!$conn) { echo "<h2>db connection error.</h2>".var_dump(oci_error()); die(); } if($_REQUEST['mjno']!="") { $MAJOR_NO=htmlentities($_REQUEST['mjno']); $YEAR=htmlentities($_REQUEST['YEAR']); $sql=""; if($_REQUEST['submit']=="Add") $sql="INSERT INTO classes (MAJOR_NO,YEAR) VALUES($MAJOR_NO,$YEAR)"; else $sql="UPDATE classes set YEAR=$YEAR,MAJOR_NO=$MAJOR_NO where (MAJOR_NO,YEAR)=((".$_REQUEST['id']."))"; $s=oci_parse($conn,$sql); oci_execute($s,OCI_COMMIT_ON_SUCCESS); header( 'Location: class.php' ); } $major_selected=0; if(isset($_REQUEST['m']) && $_REQUEST['m']!="" && $_REQUEST['m']!="0") { $major_selected=htmlentities($_REQUEST['m']); } $MAJOR_NO=0; $YEAR=2008; if($_REQUEST['action']=="edit") { $sql="SELECT * FROM classes where (MAJOR_NO,YEAR)=((".$_REQUEST['id']."))"; $s=oci_parse($conn,$sql); $result=oci_execute($s,OCI_DEFAULT); if(!$result) { echo $sql; echo "error!".var_dump(oci_error()); } $row=oci_fetch_array($s,OCI_BOTH); $MAJOR_NO=$row['MAJOR_NO']; $YEAR=$row['YEAR']; }?><html><head><title>Teacher Assistant System</title><link href="tas.css" rel="stylesheet" type="text/css"></head><body><center><a href=class.php><span class=red>[CLASSES]</span></a><h1><? if($_REQUEST['action']=="edit") echo "Modify ";else echo "Add "; ?> A Class</h1><form action=class_edit.php method=get><table border=0 cellpadding=0 cellspacing=0><tr><td>Major:</td><td><select NAME='mjno'><?php $sql="select MAJOR_NO,NAME from majors order by MAJOR_NO"; $s=oci_parse($conn,$sql);$result=oci_execute($s,OCI_COMMIT_ON_SUCCESS); while( $row=oci_fetch_array($s,OCI_BOTH) ) { echo "<option value='".$row['MAJOR_NO']."' "; if ( $row['MAJOR_NO']==$MAJOR_NO ) echo "selected"; echo ">"; echo $row['NAME']; echo "</option>"; } oci_close($conn); ?></select></td></tr><tr><td>YEAR:</td><td> <input type=text size=50 NAME=YEAR value='<?=$YEAR?>'></td></tr><tr><td></td><td><input type=submit NAME=submit border=0 value="<? if($_REQUEST['action']=="edit") echo "Update";else echo "Add"; ?>"></td></tr></table><input type=hidden NAME=id value='<?=$_REQUEST['id']?>'></form></center></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -