<?php
$connect = mysqli_connect("localhost", "root", "", "accounts");
session_start();
$param_email=$_SESSION['email'];
// If session variable is not set it will redirect to login page
if(!isset($_SESSION['email']) || empty($_SESSION['email'])){
header("location: login.php");
exit;
}
if(isset($_POST["insert"]))
{
$file = addslashes(file_get_contents($_FILES["image"]["tmp_name"]));
$query = "UPDATE users SET image='$file' where email= $param_email";
if(mysqli_query($connect, $query))
{
echo '<script>alert("Image Inserted into Database")</script>';
}
}
?>
I cannot update the image when I put the where but when I remove it it would succefully insert but not update. I need help with this the session email is to check if the user really has logged in or not but the file is the image my only problem is the update. Why is it not working? Thanks :)