I'm trying to make an archive website for a school project, and while I followed a bunch of different tutorials it seems like something is just not clicking, because nothing gets added to the database (ALTHOUGH files get added to the file they're supposed to go to).
Here's the code that's supposed to link the input page to the database:
<?php
include ('config.php');
if(isset($_POST['upload']))
{
$TITLE= $_POST['title'];
$NAMES= $_POST['names'];
$DESCRIPTION= $_POST['description'];
$FILE= $_FILES ['file'];
$file_location = $_FILES['file']['tmp_name'];
$file_name = $_FILES['file']['name'];
$file_up = "files/".$file_name;
$insert = "INSERT INTO projects ('title', 'names', 'description', 'file') VALUES('$TITLE', '$NAMES', '$DESCRIPTION', '$file_up')";
if(move_uploaded_file($file_location, './files/'.$file_name))
{
echo "<script>alert('تمت إضافة المشروع بنجاح!') </script>";
}
else{
echo "<script>alert('جرب مرة أخرى') </script>";
}
header('location: archive.php');
}
?>
the config.php code:
<?php
$servername= 'sql211.infinityfree.com';
$username= 'if0_36063631';
$password= 'zm4UGYGlSxhNB';
$database= 'if0_36063631_projects';
$conn=new mysqli($servername, $username, $password, $database);
?>
If anyone figures the problem out please explain it in simple terms