MySQL似乎不起作用

So I made my first database online. I used phpmyadmin, I created the table and the user.
Now I'd like to show the table on a page of my site, as well as giving the possibility to people to edit the database from the site.
My problem is that the database does not work: it doesn't connect. I have no idea what to do.
My database is called letstenf_santi and my table passeggeri. This is the code I'm trying to use to show the table on the site.

<?php 
//establishing connection
mysql_connect('localhost', 'root', '');
//selecting a database
mysql_select_db('letstenf_santi');
$sql  = 'SELECT * FROM `letstenf_santi`.`passeggeri`';
$records=mysql_query($sql);
?>

<html>
 <head>
  <title>mostra</title>
 </head>
 <body>
<table width="300" border="1" cellpadding="10" cellspacing="1">
 <tr>
<th>id pass</th>
<th>nome</th>
<th>eta</th>
<th>sesso</th>
 </tr>
 <?php
 while($pass=mysql_fetch_assoc($records)){
  echo "<tr>";
echo "<td>".$pass['idpasseggero']."</td>";
echo "<td>".$pass['nome']."</td>";
echo "<td>".$pass['eta']."</td>";
echo "<td>".$pass['sesso']."</td>";
echo "</tr>";
 }
 ?>
</table>
 </body>
</html>

instead of this, mysql_connect('localhost', 'root', ''); mysql_select_db('letstenf_santi');

you can try this,

$connection=mysql_connect('localhost', 'root', '');

$db=mysql_select_db('letstenf_santi',$connection);

try this code

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "letstenf_santi";//your db name

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM tablename";//replace table name with your table name
$result = mysqli_query($conn, $sql); ?>
<html>
 <head>
  <title>mostra</title>
 </head>
 <body>
<table width="300" border="1" cellpadding="10" cellspacing="1">
 <tr>
<th>id pass</th>
<th>nome</th>
<th>eta</th>
<th>sesso</th>
 </tr>
<?php if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "<tr>";
echo "<td>".$row['idpasseggero']."</td>";
echo "<td>".$row['nome']."</td>";
echo "<td>".$row['eta']."</td>";
echo "<td>".$row['sesso']."</td>";
echo "</tr>";
    }
} else {
    echo "0 results";
}

mysqli_close($conn);
?>
</table>
</body>
</html>