Read Me
Beware of line Number 20. It may give Errors
Example:
//charset for your database
$charset = "utf-8";
//connection params
$connection = array(DBHOST,DBUSER,DBPASS,DBNAME,DBPORT);
//error handling
//If you are using an error class named "errorclass" with a function in it name "set" to set error
$error = array("errorclass","set");
//If you are using an error function (not a part of error class) named "errorfunction"
$error = array("errorfunction");
//If you want the script to die set die flag in class to true. for throwing new exception set it to false.
$db = new sundb($charset, $connection, $error);
//To get a row in object
$resobj = $db->getone("select * from @ where field1=# and field2=#",array(tablename,var1,var2));
//To get a row in array after querying you need to set the third param as false.
$resarr = $db->getone("select * from @ where field1=# and field2=#",array(tablename,var1,var2),false);
//To count records
$res = $db->countrecs("field1=# and field2=#",array(tablename,var1,var2));
//To get one field LIMIT 0,1
$red = $db->getfield("field1=# and field2=#",array(tablename,var1,var2),fieldname);
//To get all rows as objects in a big array
$res = $db->getall("select * from @ where field1=# and field2=#",array(tablename,var1,var2));
//To execute a query
$db->query("update @ set field1=# where field2=#",array(tablename,var1,var2));
Also Check
$db->getcertain()
$db->getlimit()
$db->insert_id()