<?php session_start(); include_once('../../db/saucerer.php'); if(isset($_POST['submit'])){ $code = mysqli_real_escape_string($mysqli, $_POST['code']); $sql = "UPDATE access SET code = '$code'"; //use for MySQLi OOP if(mysqli_query($mysqli, $sql)){ $_SESSION['success'] = 'Access code updated to '.$code.' successfully'; $_SESSION['access'] = $code; } else{ $_SESSION['error'] = 'Something went wrong while updating the access code!'; } } header('location: ../../'); ?>