I am new to PHP and want to create a script that will update the users first and last name if they need to do so. I have the code below and it ends up echoing out UPDATE fixableusers SET first='trenton' WHERE id='6'
on the settings.inc.php page but it is not updating the table. Is there a reason it is not updating the table?
<?php
include_once('dbh.php');
session_start();
$userSession = $_SESSION['id'];
if(isset($_SESSION['id'])) {
$postTest = $_POST['first'];
$sql = "UPDATE fixableusers SET first='$postTest' WHERE id='$userSession'";
} else {
echo 'Do something else';
}
My dbh.php file includes the following code:
<?php
$conn = mysqli_connect('localhost', 'root', 'root', 'users');