PHP code example of mrpck / mysqldb

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

    

mrpck / mysqldb example snippets


use Mrpck\Mysqldb\MySqlDB;

// connecting to db
$db = new MySqlDB("localhost", "mydb");
if (!$db->db_connect_id) exit;

$sql = "SELECT id, name, surname, phone, email FROM `users` ";
$result = $db->sql_query($sql);		
$num_records = $result ? $db->get_num_rows($result) : 0;

// check if row inserted or not
if ($num_records > 0) 
{
	while ($row = $db->sql_fetchrow( $result )) 
	{
		echo "<br/>";
		print_r($row);
	}
	$db->sql_freeresult($result);
}