Assessment
alert('Record was deleted successfully')
";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
}
if($_POST['dtopimg'])
{
$sql = "update examination set top_img='$top_image' where id='1' ";
if(mysqli_query($conn, $sql))
{
echo "
";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
}
if($_POST['dbotimg'])
{
$sql = "update examination set bottom_img='$bottom_image' where id='1' ";
if(mysqli_query($conn, $sql))
{
echo "
";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
}
//end of deleting picture
if($_POST['save'])
{
//top image
if($_FILES["banner_img"]["name"] != "")// this will check is file choosed or not through the file name.
{
$random_digit=rand(0000,9999);
$banner_img=$_FILES['banner_img'];
$banner_imagename=$banner_img['name'];
$temporary=$banner_img['tmp_name'];
$banner_image=$random_digit.$banner_imagename;
$target="upload/banner/$banner_image";
move_uploaded_file($temporary,$target);
$sql = "UPDATE examination SET banner_img='$banner_image' where id='1' ";
}
if(mysqli_query($conn, $sql)){
//echo "Record was updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. "
. mysqli_error($conn);
}
//top image
if($_FILES["top_img"]["name"] != "")// this will check is file choosed or not through the file name.
{
$random_digit=rand(0000,9999);
$top_img=$_FILES['top_img'];
$top_imagename=$top_img['name'];
$temporary=$top_img['tmp_name'];
$top_image=$random_digit.$top_imagename;
$target="upload/topimage/$top_image";
move_uploaded_file($temporary,$target);
$sql = "UPDATE examination SET top_img='$top_image' where id='1' ";
}
if(mysqli_query($conn, $sql)){
//echo "Record was updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. "
. mysqli_error($conn);
}
//bottom image
if($_FILES["bottom_img"]["name"] != "")// this will check is file choosed or not through the file name.
{
$random_digit=rand(0000,9999);
$bottom_img=$_FILES['bottom_img'];
$bottom_imagename=$bottom_img['name'];
$temporary=$bottom_img['tmp_name'];
$bottom_image=$random_digit.$bottom_imagename;
$target="upload/bottomimage/$bottom_image";
move_uploaded_file($temporary,$target);
$sql = "UPDATE examination SET bottom_img='$bottom_image' where id='1' ";
}
if(mysqli_query($conn, $sql)){
//echo "Record was updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. "
. mysqli_error($conn);
}
$sql = "UPDATE examination SET bottom_content='$bottom_content' ,top_content='$top_content' where id='1' ";
if(mysqli_query($conn, $sql)){
echo "Record was updated successfully.
";
} else {
echo "ERROR: Could not able to execute $sql. "
. mysqli_error($conn);
}
}
?>