title: mysql query works sometimes but not always
body: <p>I'm building a simple "little" movie cataloging database system for my own use.  The problem right now is that I've got a mySQL query that works MOST of the time but not all.  Basically it works by using a 3rd party IMDB API.  I use that to search and pull the values I need which works just fine.  It displays on my preview screen and everything.  The problem I'm running into that that while most movies work, a few do not and I can't figure out the reason.</p>
  
  <p>For example, The Fellowship of the Ring stores just fine while The Return of the King simply won't pass the query.  I can't find any differences.</p>
  
  <p>Here's my query:</p>
  
  <pre><code>    $query = "INSERT INTO movies
  (title, year, releaseDate, actors, image, runtime, genre, director, rating, watchedDate, category, series, comments, owned, ownedFormat, seen, plot, favorite, uploadDate)
  VALUES ('$title', '$year', '$releaseDate', '$actors', '$newImg', '$runtime', '$genre', '$director', '$rating', '$watchedDate', '$category', '$series', '$comments', '$owned', '$ownedFormat', '$seen', '$plot', '$favorite', '$curDate')";
  
      mysql_query($query) or die ('Error');
  </code></pre>
  
  <p>I'm not sure what else I need to provide.  It seems like some kind of difference in the movies is causing the error but I don't know.</p>
  
  <p>Thanks!</p>
  
  <p><em><strong></em>**<em></strong>  EDIT  <strong></em>**<em>*</em></strong></p>
  
  <p>So I tried switching over to mysqli.  Here's my new code:</p>
  
  <pre><code>    /* Create the prepared statement */
  if ($stmt = $mysqli-&gt;prepare("INSERT INTO movies (title, year, releaseDate, actors, image, runtime, genre, director, rating, watchedDate, category, series, comments, owned, ownedFormat, seen, plot, favorite, uploadDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
  
      /* Bind our params */
      $stmt-&gt;bind_param('sssssssssssssssssis', $title, $year, $releaseDate, $actors, $newImg, $runtime, $genre, $director, $rating, $watchedDate, $category, $series, $comments, $owned, $ownedFormat, $seen, $plot, $favorite, $curDate);
  
      /* Execute the prepared Statement */
      $stmt-&gt;execute();
  
      /* Echo results */
      echo "Inserted {$title} into database\n";
  }
  </code></pre>
  
  <p>However, now i'm getting an error that reads: 
  Fatal error: Call to a member function prepare() on a non-object on the line where the if statement starts.</p>
  
  <p>I'm assuming this is because something my query isn't an object?</p>
  
  <p>Thanks</p>