MrJames Posted December 22, 2016 Share Posted December 22, 2016 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 More sharing options...
Larry Posted December 31, 2016 Share Posted December 31, 2016 I'm happy to help but am a bit confused. It sounds like you're overthinking this. As you already have PDO and MySQLI as OOP approaches to database interactions, what's the benefit of trying to abstract either to another level? Link to comment Share on other sites More sharing options...
Recommended Posts