Advertisement
Whistik

Untitled

Sep 9th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2. $link = mysqli_connect("localhost", "my_user", "my_password", "world");
  3.  
  4. /* check connection */
  5. if (mysqli_connect_errno()) {
  6.     printf("Connect failed: %s\n", mysqli_connect_error());
  7.     exit();
  8. }
  9.  
  10. if ($result = mysqli_query($link, "SELECT Code, Name FROM Country ORDER BY Name")) {
  11.  
  12.     /* determine number of rows result set */
  13.     $row_cnt = mysqli_num_rows($result);
  14.  
  15.     printf("Result set has %d rows.\n", $row_cnt);
  16.  
  17.     /* close result set */
  18.     mysqli_free_result($result);
  19. }
  20.  
  21. /* close connection */
  22. mysqli_close($link);
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement