I am trying to upload the name of an image and the name of the user to a database already created and its not working. Everything in the code is working(putting the file in the file system etc) less putting the name of the file in the database. I've tried without the ,now() and everything and its still not working.
<?php
include_once("php_includes/check_login_status.php");
if($_FILES['image']['name'])
{
$fileName = $_FILES["image"]["name"];
$kaboom = explode(".", $fileName);
$fileExt = end($kaboom);
$db_file_name = date("DMjGisY")."".rand(1000,9999).".".$fileExt;
$destination_path = getcwd()."/user/$log_username/$db_file_name";
$target_path = $destination_path . basename( $_FILES["image"]["name"]);
move_uploaded_file($_FILES['image']['tmp_name'], $target_path);
}
$sql="INSERT INTO photos(user,filename) VALUES('$log_username', '$db_file_name',now()))";
$query = mysqli_query($db_conx, $sql);
if($query)
echo "Image uploaded";
else
echo "ERROR";
/*<script> location.replace('../user.php?u=<?php echo $log_username;?>'); </script> */
?>