Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP class to access MySQL database using mysqli



5:13 pm on Feb 9, 2014 (gmt 0)


Do you know if there is a class (with all the methods for SELECT, COUNT, INSERT etc) that I can use to access MySQL db using mysqli?
I used to work with a class that unfortunately uses mysql and not mysqli.

Any suggestion?



12:58 pm on Feb 16, 2014 (gmt 0)

class ?
you are the man who create the class, then you cerate var for this class, then you create method(function) to this class where you put something like this, for example:

$db = new mysqli('dbhost', 'dbuser', 'dbpass', 'dbname');
$db -> query("SET NAMES 'latin2'");
$stmt = $db->stmt_init();
if($stmt->prepare("INSERT INTO `name` (`id`, `username`, `email`, `quantity`, `status`, `date` ) VALUES (?, ?, ?, ?, ?, NOW())")) {
$stmt->bind_param('issss', $a, $b, $c, $d, $e);
// Set your variables
$a = "mysql_real_escape_string(NULL)";
$b = "$var1";
$c = "$var2";
$d = "$var3";
$e = "$var4";
if(!$stmt) {
$feedback = die(mysql_error());
echo 'UPS something goes wrong :).';
return $feedback;
} else {
$feedback = 'All ok !';
echo $feedback;


9:15 pm on Feb 16, 2014 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

@bethesda: I think the OP is after a wrapper/library for mysqli that provides more direct methods for SELECT, COUNT, etc. Similar (but a lot more than) the database class you posted in your other thread: www.webmasterworld.com/php/4645709.htm

Featured Threads

Hot Threads This Week

Hot Threads This Month