fork download
  1. //index.php
  2.  
  3.  
  4. <!DOCTYPE html>
  5. <html>
  6.  
  7. <head>
  8. <title>Microboard</title>
  9. </head>
  10.  
  11. <body>
  12.  
  13. <?php
  14.  
  15. $db = array('host' => 'localhost', 'user' => 'root', 'pass' => '', 'name' => 'microboard');
  16. $link = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name']);
  17.  
  18. $queryResult = mysqli_query($link, "SELECT * FROM posts");
  19.  
  20. //var_dump($queryResult);
  21.  
  22. //$data = mysqli_fetch_assoc($queryResult);
  23. $headersNumber = $queryResult -> num_rows;
  24. //$row = mysqli_fetch_row($queryResult);
  25.  
  26. for ($i=0; $i<$headersNumber; $i++) {
  27. $row = mysqli_fetch_row($queryResult);
  28.  
  29. echo "<p><b>№$row[0] $row[2] $row[3]</b><br>$row[1]</p><hr>";
  30.  
  31. }
  32.  
  33.  
  34.  
  35. ?>
  36.  
  37. <script type="text/javascript">
  38. alert("test");
  39. </script>
  40.  
  41. <form method="post" action="/post.php">
  42.  
  43. Name:
  44. <input type="text" name="username">
  45. <br>
  46. Комментарий:<br>
  47. <textarea type="text" name="text" rows="3" cols="64" required></textarea>
  48. <br>
  49. <input type="submit" value="Отправить пост">
  50.  
  51. </form>
  52. </body>
  53.  
  54. </html>
  55.  
Runtime error #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
//index.php


<!DOCTYPE html>
<html>

<head>
	<title>Microboard</title>
</head>

<body>

stderr
PHP Fatal error:  Call to undefined function mysqli_connect() in /home/v0oKAp/prog.php on line 17