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=''){
    case is_int($value):
            //Thinking something like, for integer etc
            $type = mysqli_stmt::bind_param(i);
            $type = PDO::PARAM_INT;
    case is_bool($value):
            $type = PDO::PARAM_BOOL;
            $type = PDO::PARAM_STR;

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

Any help would be much appreciated 




My Setup


Windows XP




Share this post

Link to post
Share on other sites

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?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...