MySQL

Downloads
1.4.3
2009 to 2016
Stable

This is a MySQLi wrapper library for PHP. It is object oriented and simplifies boilerplate code you need to write when using MySQL with PHP. The object model is similar to .NET. Parameterized queries are integral part.










Example

This is a basic example demonstrating how to use the library. Here, we read and display the contents of a table and filter by two parameters. Parameters are escaped and you can pass them as arguments to the method instead of concatenating SQL query parts.

<?php
	include('bytecode77.mysql.php');

	$sql = new SqlConnection('localhost', 'root', '123456');
	$sql->setCurrentDatabase('database1');

	$reader = $sql->ExecuteReader
	(
		'SELECT * FROM users WHERE RoleKey = {"0"} AND DepartmentID = {1}',
		[ 'USER_ROLE', 34 ]
	);

	while ($row = $reader->Read())
	{
		print('User ' . $row['Name'] . ': ');
		print_r($row);
	}
?>

Looks clean, doesn't it?