Advertisement
informaticage

Untitled

Jul 9th, 2019
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.       $db = new mysqli("server_address","db_user","db_password","db_name");
  3.       // Check connection
  4.       if ( $db->connect_errno ( ) )
  5.       {
  6.             die("Errore di connessione al database MySQL: " . mysqli_connect_error());
  7.       }
  8.  
  9.       // Perform queries
  10.       $sql = "SELECT * FROM Libro";
  11.  
  12.       if (!$result = $db->query($sql) ) {
  13.             die("Errore query");
  14.       }
  15.  
  16.       while ($book = $result->fetch_assoc()) {
  17.             echo $book['titolo'] . ' ' . $book['n_pagine'];
  18.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement