title: Syntax error when inserting into database
body: <p>I am trying to insert a pdf file into my database, using php. I know that is typically not good practice, but I need to none the less.</p>
  
  <p>So here is the schema for the table I am trying to insert the pdf into:</p>
  
  <pre><code>    create table manager_certificate(
      manager_id int,
      certificate_id int,
      certificate blob,
      primary key(manager_id, certificate_id),
      foreign key(manager_id) references manager(id)
  ) ENGINE=InnoDB;
  </code></pre>
  
  <p>I have an html page that allows the use to select the file, and has an upload button that call the php file that should upload the file to the database.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
      &lt;title&gt;MySQL file upload example&lt;/title&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="manager_upload.php" method="post" enctype="multipart/form-data"&gt;
          &lt;input type="file" name="uploaded_file"&gt;&lt;br&gt;
          &lt;input type="submit" value="Upload file"&gt;
      &lt;/form&gt;
      &lt;p&gt;
          &lt;a href="list_files.php"&gt;See all files&lt;/a&gt;
      &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>php:</p>
  
  <pre><code>&lt;?php
  // Check if a file has been uploaded
  if(isset($_FILES['uploaded_file'])) {
      // Make sure the file was sent without errors
      if($_FILES['uploaded_file']['error'] == 0) {
          // Connect to the database
          $dbLink = new mysqli('dbclass.cs.nmsu.edu', 'corbinc', 'corbinc430', 'cs482corbinc');
          if(mysqli_connect_errno()) {
              die("MySQL connection failed: ". mysqli_connect_error());
          }
  
          // Gather all required data
          $data = $dbLink-&gt;real_escape_string(file_get_contents($_FILES  ['uploaded_file']['tmp_name']));
  
          // Create the SQL query
          $query = "
              INSERT INTO 'manager_certificate'('certificate')
              VALUES ( '{$data}' )";
  
          // Execute the query
          $result = $dbLink-&gt;query($query);
  
          // Check if it was successfull
          if($result) {
              echo 'Success! Your file was successfully added!';
          }
          else {
              echo 'Error! Failed to insert the file'
                 . "&lt;pre&gt;{$dbLink-&gt;error}&lt;/pre&gt;";
          }
      }
      else {
          echo 'An error accured while the file was being uploaded. '
             . 'Error code: '. intval($_FILES['uploaded_file']['error']);
      }
  
      // Close the mysql connection
      $dbLink-&gt;close();
  }
  else {
      echo 'Error! A file was not sent!';
  }
  
  ?&gt;
  </code></pre>
  
  <p>So I have tried the above code and I am getting the following error:</p>
  
  <pre><code>Error! Failed to insert the file
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''manager_certificate'('certificate')
              VALUES ( '%PDF-1.5\n%ÐÔÅØ\n3 0 ' at line 1
  </code></pre>
  
  <p>How can I fix this error? Is the problem in my schema? Or the php maybe?</p>