function test_AddRow_CourseAssessmentMethod() { $_POST['hfcamtot'] = 2; for ($i = 1; $i <= $_POST["hfcamtot"]; $i++) { $tval1 = "name"; //$_POST[$tval1] = "name"; $tval2 = "description"; $_POST[$tval2] = "description"; $_POST["ddlcnm"] = 205; $_SESSION["userid"] = 3; $_SESSION["ddlsem3"] = 4; if (isset($_POST[$tval1]) && trim($_POST[$tval1]) != "") { $sql = "insert into cams(camname,camdetails,csid,uid,semid)values('" . $_POST[$tval1] . "','" . $_POST[$tval2] . "'," . $_POST["ddlcnm"] . "," . $_SESSION["userid"] . "," . $_SESSION["ddlsem3"] . ")"; $insertedId = ReturnInsertedID($sql); $savedIds = $savedIds . $insertedId . ","; } else { $hfval = "hfval"; $_POST[$hfval] = 545; if (isset($_POST[$hfval]) && trim($_POST[$hfval]) != "") { $tval1 = "name1"; $_POST[$tval1] = "name1"; $tval2 = "name2"; $_POST[$tval2] = "name2"; if (trim($_POST[$tval1]) != "") { $sql = "update cams set camname='" . $_POST[$tval1] . "',camdetails='" . $_POST[$tval2] . "' where camid=" . $_POST[$hfval]; ExecuteNonQuery($sql); $savedIds = $savedIds . $_POST[$hfval] . ","; } } } } //for end $this->assertNotNull($savedIds); }
} } } } if ($savedId != "") { $savedId = rtrim($savedId, ','); $sql = "delete from fclo where fcloid not in(" . $savedId . ") and semid=" . $_SESSION["ddlsem3"] . " and uid=" . $_SESSION["userid"] . " and csid=" . $_POST["ddlcnm"]; ExecuteNonQuery($sql); } $savedIds = ""; for ($i = 1; $i <= $_POST["hfcamtot"]; $i++) { $tval1 = "txtcam_" . $i . "_0"; $tval2 = "tacam_" . $i . "_0"; if (isset($_POST[$tval1]) && trim($_POST[$tval1]) != "") { $sql = "insert into cams(camname,camdetails,csid,uid,semid)values('" . $_POST[$tval1] . "','" . $_POST[$tval2] . "'," . $_POST["ddlcnm"] . "," . $_SESSION["userid"] . "," . $_SESSION["ddlsem3"] . ")"; $insertedId = ReturnInsertedID($sql); $savedIds = $savedIds . $insertedId . ","; } else { $hfval = "hfcam_" . $i; if (isset($_POST[$hfval]) && trim($_POST[$hfval]) != "") { $tval1 = "txtcam_" . $i . "_" . $_POST[$hfval]; $tval2 = "tacam_" . $i . "_" . $_POST[$hfval]; if (trim($_POST[$tval1]) != "") { $sql = "update cams set camname='" . $_POST[$tval1] . "',camdetails='" . $_POST[$tval2] . "' where camid=" . $_POST[$hfval]; ExecuteNonQuery($sql); $savedIds = $savedIds . $_POST[$hfval] . ","; } } } } if ($savedIds != "") {