After I used prepared statements to reduce the risk of SQL injection, the button click makes the page blank. I could not find any errors in my code. What is causing the page to go blank and how can I prevent it from happening?
if(isset($_POST['desc_btn'])) {
$code = mysqli_real_escape_string($con, strip_tags($_POST['code_desc']));
$desc = mysqli_real_escape_string($con, strip_tags($_POST['description']));
$code_select = $con->prepare("SELECT * FROM data WHERE code=?");
$code_select->bind_param("s", $code);
$code_select->execute();
$data = $code_select->get_result();
$data_user_id = $data['user_id'];
$data_id = $data['id'];
if($user_id == $data_user_id ) {
$code_select->close();
$update = $con->prepare("UPDATE data SET description=? WHERE id=?");
$update->bind_param('s', $desc, $data_id;
$update->execute();
$update->close();
}
}
error_reporting(E_ALL);
Thanks for your help. I am open to any input.