Advertisement
mraps98

PHP_displayingfromSQL

Feb 9th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. $dbhost = 'localhost';
  2. $dbuser = 'db4133414';
  3. $dbpass = 'db4133414';
  4. $dbname = 'db4133414';
  5. $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  6. if ($conn->connect_error) {
  7.     echo "Connection failed<br/>";
  8.     die("Connection failed: " . $conn->connect_error);
  9. }
  10. $sql = "select * from employee";
  11. $result = $conn->query($sql);
  12. while($row = $result->fetch_assoc())
  13. {
  14.     echo $row["firstname"];
  15.     echo $row["surname"];
  16.     echo " \n";
  17. }
  18. $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement