Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. header( 'Content-Type: text/html; charset=utf-8' );
  2. $db_hostname = "localhost";
  3. $db_database = "cms";
  4. $db_username = "root";
  5. $db_password = "";
  6.  
  7. $connection = new mysqli($db_hostname,$db_username,$db_password,$db_database);
  8. if($connection-> connect_error) die($connection -> connect_error);
  9. $query = "SELECT * FROM category";
  10. $result = $connection -> query($query);
  11. if(!$result) die($connection -> connect_error);
  12. for($i = 0, $lenght = $result -> num_rows; $i < $lenght;$i++){
  13. $result -> data_seek($i);
  14. $row = $result -> fetch_assoc();
  15. echo $row['title']."<br>";
  16. }
  17. $result -> close();
  18.  
  19. $connection->set_charset("utf8");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement