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

Re: PHP / MySQLi Bind Statement 80 80

This isn't really something I have any experience with, but are you talking about something like this??

http://dev.mysql.com/doc/refman/5.7/en/user-variables.html

Re: PHP / MySQLi Bind Statement 80 80

@Dani I think it's related more to prepared statements in ext/mysqli:

@Sunny

See if this comment helps:

Note: when uploading a blob consider to convert it into a string, otherwise look at:

Re: PHP / MySQLi Bind Statement 80 80

Ah, that makes more sense :)

Be a part of the DaniWeb community

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