fork download
  1. <?php
  2. include_once('init.php');
  3.  
  4. $mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['name']);
  5. if ($mysqli->connect_errno) {
  6. echo "Не удалось подключиться к MySQL: " . $mysqli->connect_error;
  7. }
  8.  
  9. if (!($stmt = $mysqli->prepare("SELECT posts.post_id, posts.user_id, users.user_login, posts.post_text, posts.post_time, posts.is_deleted
  10. FROM posts JOIN users on users.user_id = posts.user_id ORDER BY post_id"))) {
  11. echo "Не удалось подготовить запрос: (" . $mysqli->errno . ") " . $mysqli->error;
  12. }
  13.  
  14. if (!$stmt->execute()) {
  15. echo "Не удалось выполнить запрос: (" . $stmt->errno . ") " . $stmt->error;
  16. }
  17.  
  18. $queryResult = $stmt->get_result();
  19.  
  20. $posts = $queryResult->fetch_all(MYSQLI_ASSOC);
  21.  
  22. //echo "<pre>";
  23. //var_dump($posts);
  24.  
  25. if (isset($_SESSION['user_login'])) {
  26. $userName = $_SESSION['user_login'];
  27. $userId = $_SESSION['user_id'];
  28. } else {
  29. $userId = 'null';
  30. }
  31.  
  32. include ('view.php');
  33. ?>
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  include_once(init.php): failed to open stream: No such file or directory in /home/zsNriu/prog.php on line 2
PHP Warning:  include_once(): Failed opening 'init.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/zsNriu/prog.php on line 2
PHP Fatal error:  Class 'mysqli' not found in /home/zsNriu/prog.php on line 4