title: MySQLi procedural query, what's wrong?
body: <pre><code>//Successful connection to $db
  
  function insert_users($db, $username, $password, $email)
  {
      echo "FUNCTION CALLED"; //This is outputted successfully
  
      $query = "INSERT INTO `users` (`id`, `username`, `password`, `email`) VALUES ('', ?, ?, ?)";
      $stmt = mysqli_stmt_init($db);
  
      if(mysqli_stmt_prepare($stmt, $query))
      {
          echo "QUERY PREPARED"; // rest of code was snipped (will put up upon request)
      } else {
          echo "QUERY DENIED"; //This is outputted successfully
      }
  }
  
  
  //The $user $pass and $mail are defined and then the function is called
  
  insert_users($db, $user, $pass, $mail);
  </code></pre>
  
  <p>Database structure:</p>
  
  <pre><code>testdb (database)
      -&gt; users (table)
          -&gt; id            //Primary key, unique key
          -&gt; username      //unique key
          -&gt; password
          -&gt; email
  </code></pre>
  
  <p>Why doens't the query go through with it's operation?
  It echoes "Query denied" instead of "Query prepared". The query is invalid I believe. If more information is required, ill be happy to edit this question</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I added</p>
  
  <p><code>mysqli_stmt_error($stmt);</code>after the <code>echo "QUERY DENIED";</code>
  nothing happens...</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>$server = 'localhost';
  $user = 'root';
  $password = '';
  $databse = 'testdb';
  
  $db = @mysqli_connect($server, $user, $password, $database) or die("Could not connect to Database server. Please inform an administrator");
  </code></pre>
  
  <p>That's my database setup. Do i put the variables in quotes?</p>