Hi,

I am looking to create a MySQLi class(MVC pattern), I already have the following functions: Query, Execute, Results. Below is a PDO version of a Bind statement and was wondering if you could do the following in MySQLi or something similar in MySQLi:

public function bind($param, $value, $type=''){
if(is_null($type)){
   switch(true){
    case is_int($value):
            //Thinking something like, for integer etc
            $type = mysqli_stmt::bind_param(i);

            $type = PDO::PARAM_INT;
            break;
    case is_bool($value):
            $type = PDO::PARAM_BOOL;
            break;
            default:
            $type = PDO::PARAM_STR;
   }
}
$this->stmt->bindvalue($param,$value,$type);
}

Then in my MySQLiUser class where I want Bind to be called

$database->query(SELECT/INSERT/UPDATE/DELETE);

$database->bind($type, $userName);
$database->execute();

$rows = $database->results();

Any comments, questions or feeback would be greatly appreciated

Ah, that makes more sense :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.