title: mySQL Query Error in wordpress
body: <p>I have this code:</p>
  
  <pre><code>add_action( 'delete_post', 'my_delete_function' );
   function my_delete_function($post_id) { 
      global $wpdb;
      $achievement = get_the_category($post_id); 
      $h = $achievement[0]-&gt;cat_ID; 
      $s = ''.str_replace('"', '', $h);
      $p = var_dump(htmlentities($s));
     $wpdb-&gt;query("INSERT INTO ".$wpdb-&gt;prefix."votes (post, votes, guests, usersinks, guestsinks) VALUES('', ".$p.", '', '', '') ") or die(mysql_error());
  }
  </code></pre>
  
  <p>mySQL keeps throwing this error</p>
  
  <pre><code>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 ' '', '', '')' at line 1
  </code></pre>
  
  <p>Ive ran the same query in phpMyAdmin, replacing the php vars with values and it works fine</p>
  
  <p>Additionally, ive made sure the the value of $s is just a number by using the echo function on a blank page.</p>
  
  <p>Any help is appreciated</p>