CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
$connection = new createConnection();
$connection->connect();
$aid = $_POST['author_id'];
$name = $_REQUEST['name'];
$country = $_REQUEST['country'];
$status = $_REQUEST['status'];
if($status == 'Inactive'){
$is_active = 'no';
}else{
$is_active = 'yes';
}
$date = date('Y-m-d');
$userId = $_SESSION['userId'];
$select="SELECT * FROM country WHERE country_name = '$country'";
$query =mysqli_query($connection->myconn, $select);
$result=mysqli_fetch_assoc($query);
$country_id = $result['country_id'];
$updates = "UPDATE authors SET authors_name='$name',country_id='$country_id',modified_on='$date',modified_by='".(int)$userId."',is_active='$is_active' WHERE authors_id='$aid'";
if(mysqli_query($connection->myconn,$updates) === TRUE )
{
$_SESSION['ERROR_MSG'] = "Success";
$_SESSION['MSG_ALRT'] = "TRUE";
header('location: authors.php');
}
else
{
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location: authors.php');
}
?>