PHP code example of joungkyun / mysql-extension-wrapper

1. Go to this page and download the library: Download joungkyun/mysql-extension-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/ */

    

joungkyun / mysql-extension-wrapper example snippets


    

    # old code
    $con = mysql_connect();
    if ( ! is_resource($con) ) {
        die ("connect failed\n");
    }

    # wrapper code
    $con = mysql_connect();
    if ( ! is_myresource($con) ) {
        die ("connect filed\n");
    }
    


# even if loaded mysql extension, well done.
');
if ( ! is_myresource ($con) ) {
	trigger_error(sprintf('Connect error: %s', mysql_error()), E_USER_ERROR);
	exit;
}

mysql_select_db('mysql', $con);
mysql_set_charset ('utf8', $con);

$result = mysql_query ('SELECT * FROM user', $con);
if ( ! is_myresource($result) ) {
	trigger_error(sprintf('Query Error: %s', mysql_error()), E_USER_WARNING);
}

$rno = mysql_num_rows($result);

while ( ($row = mysql_fetch_object($result)) ) {
	printf("User: %s, Host: %s\n", $row->user, $row->host);
}

mysql_free_result($result);
mysql_close($con);



 'mysql_connect is supported ';
if ( function_exists('mysql_connect') )
    echo 'YES';
else
    echo 'NO';

echo "\n";