PHP code example of pershin / mysql_backward_compatibility_wrapper

1. Go to this page and download the library: Download pershin/mysql_backward_compatibility_wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pershin / mysql_backward_compatibility_wrapper example snippets






name = 'mysql_user';
$password = 'mysql_password';
$database_name = 'information_schema';

$link = mysql_connect('localhost', $username, $password);

if (!is_resource($link)) {
    die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db($database_name, $link);

if (!$db_selected) {
    die('Can\'t use ' . $database_name . ': ' . mysql_error() . PHP_EOL);
}

$query = 'SELECT * FROM `TABLES` ORDER BY `DATA_LENGTH` DESC';
$result = mysql_query($query, $link);

if (is_resource($result)) {
    $num_rows = mysql_num_rows($result);

    for ($i = 0; $num_rows > $i; $i++) {
        $row = mysql_fetch_assoc($result);
        echo $row['TABLE_SCHEMA'], '.', $row['TABLE_NAME'], ' (',
        number_format($row['DATA_LENGTH']), ' bytes)', PHP_EOL;
    }

    mysql_free_result($result);
}

mysql_close($link);




endor\pershin\mysql_backward_compatibility_wrapper\MySQL;

MySQL::$debugging = true;

mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_query('SELECT 2 + 2');

print_r(MySQL::$queries);