include_once "pagebody.php"; pageHeader(); $pageTitle="นำเข้าข้อมูลนักศึกษาจากระบบทะเบียนฯ"; ?>
echo $pageTitle; ?> |
if ($method=="import"){ include_once "clsUser.php"; include_once "clsUmUser.php"; include_once "clsStudentT.php"; $oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB'], $GLOBALS['USER'], $GLOBALS['PASSWORD']); $oC1 = new clsConnection($dbHost, $dbName, $dbUserName, $dbPassword); $oUs = new clsUser($oC); $oUm = new umuser($oC); $oS = new StudentT($oC1); $oS->RSStudent(); $oC->BeginTrans(); echo "
นักศึกษา | ดำเนินการ |
---|---|
$oS->studentCode :: $oS->studentNameSurname | "; echo ""; $oUm->searchByUserLogin($oS->studentCode); //หาตามรหัสนิสิต if (!$oUm->GetRecord()){ //ถ้าไม่มีใน um $oU->addNewUser($oS->studentCode, $oS->studentNameSurname, 6, 2, $oS->studentCode, $oS->studentCode); echo "เพิ่มใหม่ "; }else{ //มีใน um if ($oS->studentStatus<=4){ //สถานะ อยู่ $sql = "update umuser set UsName='$oS->studentNameSurname', UsActive=1 where UsLogin='$oS->studentCode'"; $oC->Execute($sql); echo "ปรับปรุงสถานะเป็น active"; }else{ //สถานะ ไม่อยู่ ออก $sql = "update umuser set UsName='$oS->studentNameSurname', UsActive=0 where UsLogin='$oS->studentCode'"; $oC->Execute($sql); echo "ปรับปรุงสถานะเป็น No active"; } } $i++; echo " |
จำนวนทั้งสิ้น $i รายการ |