Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. $host = 'localhost';
  3. $user = 'root';
  4. $password = '';
  5. $database = 'prospech';
  6. $db_con = mysql_connect($host,$user,$password,$database);
  7. if ($db_con){
  8. echo 'Connected with MySQL';
  9. echo '<br />';
  10. } else {
  11. echo 'Failed to connect';
  12. echo '<br />';
  13. mysqli_connect_error();
  14. exit();
  15. }
  16. $sql = "SELECT * FROM student";
  17. $result = $db->query($sql);
  18. if (mysqli_num_rows($result) > 0)
  19. {
  20. while($cyka = mysqli_fetch_assoc())
  21. {
  22. echo "id: " . $cyka["id"]. " - Name: " . $cyka["firstname"]. " " . $cyka["lastname"]. "<br>";
  23. }
  24. }
  25.  
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement