Advertisement
Guest User

Untitled

a guest
Jun 6th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. config.php:
  2.  
  3. // Mysqldaten
  4. $mysqlhost = "localhost";
  5. $mysqluser = "root";
  6. $mysqlpass = "";
  7. $mysqldb   = "lukasbook";
  8.  
  9. // Verbindung herstellen
  10. $connection = mysql_connect($mysqlhost, $mysqluser, $mysqlpass) or die ("Verbindungsversuch fehlgeschlagen.");
  11.  
  12. // Datenbank auswählen
  13. $selectdb = mysql_select_db($mysqldb, $connection) or die ("Datenbank konnte nicht ausgewählt werden.");
  14.  
  15.  
  16.  
  17.  
  18. showentrys.php:
  19. require_once "config.php";
  20.  
  21. $connection;
  22. $selectdb;
  23. $sql_showentrys = "SELECT ID name, email, text FROM entry";
  24. $query_showentrys = mysql_query($sql_showentrys) or die ("Anfrage nicht erfolgreich.");
  25. $anzahl_showentrys = mysql_num_rows($query_showentrys);
  26.  
  27. echo "Zur Zeit gibt es bereits $anzahl_showentrys Einträge!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement