PHP ADODB & MySQL,绑定参数

PHP ADODB & MySQL, binding parameters

我正在使用 ADODB 和 MYSQL,试图执行 INSERT 语句。

虽然我已经阅读了大量论坛帖子并了解到我无法像使用 oci8 那样轻松地绑定参数,但我仍然没有找到与我想要实现的目标类似的示例。我的代码如下与 oci8:

$street = $branch->getStreet();
$number = $branch->getNumber();
$city = $branch->getCity();
$state = $branch->getState();
$xMap = $branch->getXMap();
$yMap = $branch->getYMap();
$email = $branch->getEmail();

try{

    //$this->db->debug = true;                    
    $sql = "INSERT INTO branch ( nombre_branch, street, number, city, state, x_map, y_map, email ) VALUES (:branchName, :street, :number, :city, :state, :xMap, :yMap, :email)";
    $sp = $this->db->PrepareSP($sql);

    $this->db->InParameter($sp, $branchName, 'branchName');
                $this->db->InParameter($sp, $street, 'street');
                $this->db->InParameter($sp, $number, 'number');
                $this->db->InParameter($sp, $city, 'city');
                $this->db->InParameter($sp, $state, 'state');
                $this->db->InParameter($sp, $xMap, 'xMap');
                $this->db->InParameter($sp, $yMap, 'yMap');
                $this->db->InParameter($sp, $email, 'email');

                $rs = $this->db->Execute($sp);                     

    } catch(ADODB_Exception $adodb_exception){
        $logInfo['exception'] = $adodb_exception->getMessage();
        $message = "'[".__CLASS__."] Error al executing ' insert '";


        if( !$this->rollbackTransaction()){
            if(!is_null($this->log)) $this->log->log("ERROR in DB: ".print_r($logInfo, true), PEAR_LOG_ERR);
            $message .= " Error in ROLLBACK.";

            throw new DAODatabaseTransactionException ($message, $adodb_exception->getCode());
        }           
    }
            return $returnValue;
}

谢谢!

这就是我如何让它与 mysql 一起工作,而无需实施 PDO

 $sql = "INSERT INTO branch( branch_name, street, number, city, state, x_map, y_map, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";                            

                    $rs = $this->db->Execute($sql, array($branchName, $street, $number, $city, $state, $xMap, $yMap, $email));                     
                    $rs->Close();