Skip to content

🥗 PHP MySQL Connection Helper provides easy to use methods to write and read data from a MySQL database.

License

Notifications You must be signed in to change notification settings

promatik/PHP-MySQL-Connection-Helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP MySQL Connection Helper

Usage example:

// CONSTRUCT
$db = new MySQL("localhost", "root", "password", "sample");

// SELECT
$result = $db->query("SELECT id, description, quantity FROM sample");

// NUM ROWS
$numRows = $db->numRows($result);

// Get next ID
$newId = $db->newId("sample", "id");

// UPDATE
$updateStatus = $db->updateRow("sample", array(
		"id" => 1
	), array(
		"quantity" => 1,
		"description" => "One"
	));

// INSERT
$insertStatus = $db->insertRow("sample", array(
		"description" => "teste",
		"quantity" => 6
	));

// DELETE
$deleteStatus = $db->deleteRow("sample", array(
		"quantity" => 6
	));

// FETCH ALL
$result = $db->query("SELECT * FROM sample");
$fetchAll = $db->fetchAll($result);

// FETCH ASSOC
$result = $db->query("SELECT description, quantity FROM sample");
$fetchAssoc = "";
while($row = $db->fetchAssoc($result)) {
	$fetchAssoc .= $row["quantity"]."-".$row["description"]." / ";
}

$db->close();

About

🥗 PHP MySQL Connection Helper provides easy to use methods to write and read data from a MySQL database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages