Jump to content
Larry Ullman's Book Forums

Recommended Posts

I am looking to recreate the following function from PDO to MySQLi but having some problems, I've been over the PHP website to read the functions. I'm trying to modularize my code in like the MVC pattern. 

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);
}

Is it as simple as just replacing PDO version line to :


$type = mysqli_stmt::bind(i); or just putting $type = i;


Then in my class I am trying to call the bind function:
 
$database ->bind($stmt,$ype,$variables);
$database->execute();

Any help would be much appreciated 

 

Regards

 

My Setup

Chrome

Windows XP

Wamp

SublimeText

 

Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...