title: how to upload / store any file in mysql database from php page
body: <p>So after HOURS of fruitless searching just about anywhere I could find, I'm asking for help. 
  I have a simple html form that asks for some input, and lets me select a file just fine, then sends it to a php form that is supposed to connect to my MySQL (finding nemo moment there for a second...) and save the file into a longBLOB.
  Tried reading from my /tmp directory. nada
  Tried reading straight from <code>$_FILES['userfile']['tmp_name']</code> and nada.
  Tried the code below and just about every mix and match of code I could read, glean, or shamelessly plagiarize from the interwebs and still nada.</p>
  
  <pre><code>$sendUp = $_POST["whatDoc"];
  $teamCriteria = $_POST["team"];
  $lastNameCriteria = $_POST["lastName"];
  $firstNameCriteria = $_POST["firstName"];
  
  $myFile = $_FILES['userfile']['tmp_name'];
  $fn = $_FILES['userfile']['name'];
  $fl = $_FILES['userfile']['size'];
  $fp = fopen($myFile, 'r');
  $content = fread($fp, filesize($myFile));
  $content = addslashes($content);
  
  #lines below changed for obvious reasons
  $con = mysqli_connect("the usual", "the usual", "*********", "the usual");
   if (mysqli_connect_errno())
   {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  $query = "UPDATE leo SET '$sendUp'=$content WHERE Last='$lastNameCriteria'";
  
  mysqli_query($con, $query)or die('Error, query failed');
  </code></pre>
  
  <p>at wits end here, could REALLY use a lifeline.</p>
  
  <p>Thanks all.</p>
  
  <p>ps. like I said, done a LOT of reading tonight, I know that there are better and more efficient ways to store files than to upload pics / pdf / everythingunderthesun as a BLOB in a database but that's what I'm trying to do :)</p>