0

I have my codes here, i cant update my database using this codes please help.

 if(isset($_GET['submit'])){

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "elev8groupportal";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 


//$req_code = $_POST['req_code'];
//$req_code = $_GET['req_code'];
$req_code = $_POST['req_code'];


$sql = "UPDATE request SET req_status='Waiting for Note', req_dateapprove = NOW() WHERE req_code='".$_POST['req_code']."'  LIMIT 1";
//WHERE req_code= '".$_POST['req_code']."' and req_dateapprove = NOW() ";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
}
2
Contributors
1
Reply
14
Views
2 Years
Discussion Span
Last Post by lps
0

Your "can't update" means the coonection failed or the db not updated or it always goes into echo "Error updating record: " . $conn->error; even db update?
Any error thrown?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.