Skip to main content
added 2 characters in body
Source Link
Simone Nigro
  • 4.9k
  • 5
  • 46
  • 81

mysql_ is deprecated! use mysqli_**

<?php
require_once 'connector.php';

$SQL = "SELECT u.username, h.score, h.date 
        FROM users AS u
        JOIN highscores AS h ON (h.user_id = usersu.idusers_id)";

$result = mysql_query($SQL) or die( mysql_error() );

echo "<html>
      <head>
        <title>Highscores</title>
      </head>
      <body>";
        
        
if( mysql_num_rows($result) > 0 )
{
    echo "<table border='1'>
          <tr>
          <th>user</th>
          <th>score</th>
          <th>Date</th>
      </tr>";

    while ( $row = mysql_fetch_array($result) )  
    {
        echo "<tr>";    
              
        printf("<td>%s</td>", $row['username']);
        printf("<td>%s</td>", $row['score']);
        printf("<td>%s</td>", $row['date']);
                  
        echo "</tr>";   
    }
    
echo "</table>
      </body>
      </html>";
}

mysql_free_result($result);

mysql_ is deprecated! use mysqli_**

<?php
require_once 'connector.php';

$SQL = "SELECT u.username, h.score, h.date 
        FROM users AS u
        JOIN highscores AS h ON (h.user_id = users.id)";

$result = mysql_query($SQL) or die( mysql_error() );

echo "<html>
      <head>
        <title>Highscores</title>
      </head>
      <body>";
        
        
if( mysql_num_rows($result) > 0 )
{
    echo "<table border='1'>
          <tr>
          <th>user</th>
          <th>score</th>
          <th>Date</th>
      </tr>";

    while ( $row = mysql_fetch_array($result) )  
    {
        echo "<tr>";    
              
        printf("<td>%s</td>", $row['username']);
        printf("<td>%s</td>", $row['score']);
        printf("<td>%s</td>", $row['date']);
                  
        echo "</tr>";   
    }
    
echo "</table>
      </body>
      </html>";
}

mysql_free_result($result);

mysql_ is deprecated! use mysqli_**

<?php
require_once 'connector.php';

$SQL = "SELECT u.username, h.score, h.date 
        FROM users AS u
        JOIN highscores AS h ON (h.user_id = u.users_id)";

$result = mysql_query($SQL) or die( mysql_error() );

echo "<html>
      <head>
        <title>Highscores</title>
      </head>
      <body>";
        
        
if( mysql_num_rows($result) > 0 )
{
    echo "<table border='1'>
          <tr>
          <th>user</th>
          <th>score</th>
          <th>Date</th>
      </tr>";

    while ( $row = mysql_fetch_array($result) )  
    {
        echo "<tr>";    
              
        printf("<td>%s</td>", $row['username']);
        printf("<td>%s</td>", $row['score']);
        printf("<td>%s</td>", $row['date']);
                  
        echo "</tr>";   
    }
    
echo "</table>
      </body>
      </html>";
}

mysql_free_result($result);
Source Link
Simone Nigro
  • 4.9k
  • 5
  • 46
  • 81

mysql_ is deprecated! use mysqli_**

<?php
require_once 'connector.php';

$SQL = "SELECT u.username, h.score, h.date 
        FROM users AS u
        JOIN highscores AS h ON (h.user_id = users.id)";

$result = mysql_query($SQL) or die( mysql_error() );

echo "<html>
      <head>
        <title>Highscores</title>
      </head>
      <body>";
        
        
if( mysql_num_rows($result) > 0 )
{
    echo "<table border='1'>
          <tr>
          <th>user</th>
          <th>score</th>
          <th>Date</th>
      </tr>";

    while ( $row = mysql_fetch_array($result) )  
    {
        echo "<tr>";    
              
        printf("<td>%s</td>", $row['username']);
        printf("<td>%s</td>", $row['score']);
        printf("<td>%s</td>", $row['date']);
                  
        echo "</tr>";   
    }
    
echo "</table>
      </body>
      </html>";
}

mysql_free_result($result);