Welcome Guest, Not a member yet? Register   Sign In
Mysql Stored Procedure: INOUT / OUT Paramter Support

I'm really sorry if I missed this in the documentation or forums, but is it possible to use INOUT or OUT parameters with MySQL in the database library included with CodeIgniter?

I've resorted to using PDO for this. I was hoping CI had a more simple and elegant solution. Is there a better way to do this?

            $dbh = new PDO(DB_CONN, DB_USER, DB_PASS);

            $stmt = $dbh->prepare("CALL Accounts_Insert(

            $stmt->bindParam(':email', $email, PDO::PARAM_STR);
            $stmt->bindParam(':username', $username, PDO::PARAM_STR);

            $stmt->execute() or die (implode(':',$stmt->errorInfo()));

            //get output parameter
            foreach($dbh->query("SELECT @account_id as 'account_id'") as $row)
                $account_id = $row['account_id'];
        catch(PDOException $e)
        $dbh = NULL;

Theme © iAndrew 2016 - Forum software by © MyBB