title: Insert a value into database based on Session's User ID
body: <p>Attempting to insert a Score based on the User's Session ID and POST , I've set up the database to use the UserID as a foreign key constraint but dont know how to do an insert query.</p>
  
  <p><a href="https://i.stack.imgur.com/GiRW9.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Database Values ^^</p>
  
  <p>My attempt below </p>
  
  <pre><code>&lt;?php
  include("php/functions.php");
  include('connections/conn.php');
  $userID = $_SESSION["userID"];
  //echo "all good here";
  $newsoanxscore = mysqli_real_escape_string($conn, $_POST['socanxscore']);
  $insertquery = "INSERT INTO socanxscore(socialanxietyscore)" . "VALUES('$newsoanxscore')";
  $result = mysqli_query($conn, $insertquery) or die(mysqli_error($conn));
  mysqli_close($conn);
  ?&gt; 
  </code></pre>
  
  <p>My insert form</p>
  
  <pre><code> &lt;form action="insertsoanxietyscore.php" method="post"&gt;
          Insert your score &lt;input type="number" name="socanxscore" /&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="submit" /&gt;
   &lt;/form&gt;
  </code></pre>