0

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

Edited by SunnySideUp: Forgot other class

3
Contributors
3
Replies
25
Views
8 Months
Discussion Span
Last Post by Dani
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.