having trouble figuring out why this won't work. the picture doesn't appear in the directory afterwards and instead of a file path string in the db, it just says null in the next row in the db

PHP Code:
<?php
//connect to database
  
include('scripts/db.php');

//get text and page name
  
$page=$_GET['page'];
  
$content=$_POST['add_entry_text'];
  
$category=$_GET['page'];

//insert primary info into database
  
$db->query("INSERT INTO ENTRIES(DATE, TEXT, category) VALUES (CURDATE(),'".$content."','".$page."')");

  if(isset(
$_FILES["entry_pic"])){
    
$allowedExts = array("gif""jpeg""jpg""png");
      
$location explode("."$_FILES["entry_pic"]["name"]);
      
$extension end($location);
    if (((
$_FILES["entry_pic"]["type"] == "image/gif")
      || (
$_FILES["entry_pic"]["type"] == "image/jpeg")
      || (
$_FILES["entry_pic"]["type"] == "image/jpg")
      || (
$_FILES["entry_pic"]["type"] == "image/png"))
      && (
$_FILES["entry_pic"]["size"] < 120000)
      && 
in_array($extension$allowedExts))
    {
        if (
$_FILES["entry_pic"]["error"] > 0)
          {
          echo 
"Return Code: " $_FILES["entry_pic"]["error"] . "<br>";
          }
        else{
          
$target="entry_pics/".$_FILES['entry_pic']['name'];
          
move_uploaded_file($_FILES['entry_pic']['tmp_name'], $target); 
          
$db->query("UPDATE entries SET entry_pic_path = 'entry_pics/".$_FILES['entry_pic']['name']."'
            WHERE text='"
.$content."'");
        }
    }else{
      echo 
"Invalid file";
    }
  }      
  
header("Location:index.php");
?>