Advertisement
Guest User

Untitled

a guest
Feb 12th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. Fatal error: Call to a member function bind_param() on a non-object in /home4/lunar/public_html/casino/blogpost.php on line 88
  2.  
  3. 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 ':user, :title, :message, :image, :category, NOW())' at line 1
  4.  
  5. $user = $_COOKIE['user'];
  6. $title = $_POST['title'];
  7. $message = $_POST['message'];
  8. $image = $_POST['image'];
  9. $category = $_POST['category'];
  10. $stmt = $mysqli->prepare("INSERT INTO `lunar_casino`.`posts` (`id`, `by`, `title`, `message`, `image`, `category`, `date`) VALUES(NULL, :user, :title, :message, :image, :category, NOW())");
  11. echo $mysqli->error;
  12. $stmt->bind_param(":user", $user);
  13. $stmt->bind_param(":title", $title);
  14. $stmt->bind_param(":message", $message);
  15. $stmt->bind_param(":image", $image);
  16. $stmt->bind_param(":category", $category);
  17. $stmt->execute();
  18. if(!$stmt){
  19. echo "<font color='red'><b>There has been an error with our database! Please contact the website administrator!</b></font><br /><br />";
  20. echo $mysqli->error;
  21. } else {
  22. echo "<font color='green'><b>You have successfully added a blog post!</b></font><br /><br />";
  23. }
  24.  
  25. $stmt = $mysqli->prepare("INSERT INTO `lunar_casino`.`posts` (`id`, `by`, `title`, `message`, `image`, `category`, `date`) VALUES(NULL, ?, ?, ?, ?, ?, NOW())");
  26. $stmt->bind_param("sssss", $user, $title, $message, $image, $category);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement