This is a PHP5 Class-Helper that will allow you to make MySQL actions more easy, without too much lines. You will use like only 70% of classic code, and the syntax is more easy.

Here you can see some examples:

$mysql = new EazSQL('host', 'username', 'password', 'database');

// VS Old (classic) method:
$mysql = mysql_connect('host', 'username', 'password') or die ('Mysql error, connection');
mysql_select_db('datababse', $mysql) or die ('Mysql error, database');


$foo->delete('mytable', array('' => 'id=1', 'or' => 'id=2'));

// VS Old (classic) method:
mysql_query("DELETE FROM mytable WHERE id=1 or id=2", $connection) or die ('Mysql error, delete');


Multi-queries!
$foo->multi_query(array("DELETE FROM mytable WHERE id=1", "DELETE FROM mytable WHERE content='example'", "UPDATE mytable SET val = 'CodeCanyon'"));

// VS Old (classic) method:
mysql_query("DELETE FROM mytable WHERE id=1", $connection) or die ('Mysql error, query');
mysql_query("DELETE FROM mytable WHERE content='example'", $connection) or die ('Mysql error, query');
mysql_query("UPDATE mytable SET val = 'CodeCanyon'", $connection) or die ('Mysql error, query');


Retrieve rows as object!
$results = $foo->get_rows("SELECT * FROM mytable");
foreach($results as $res) {
    echo $res->title.'<br />';
}

// Versus....
$qry = mysql_query("SELECT * FROM mytable",$connection) or die ('Mysql error, query);
if(mysql_num_rows($qry) > 0) {
    while($res = mysql_fetch_assoc($qry)) {
        echo $res['title'].'<br />';
     }
}


With this helper, you can easy make queries, multi-queries, retrieve rows as an easy syntax, do update, delete, insert, and much more! Plus, it has a very explicit Documentation.
Why you don’t try it? :D

Rating will be really appreciated. Questions? Suggestions? Please, don’t doubt to leave a comment!

by
by
by
by
by
by