bindParam错误

时间:2015-12-06 11:09:55

标签: php sql pdo

我在流动的例子中使用bindParam,但它给了我错误

错误是无法获得任何回复

$con = new PDO('odbc:Driver={SQL Server};Server='.$db_ip.';Database='.$db_name,$db_user,$db_pass);

$m_id=585948;
$sql="select n_id from users where m_id = :member ";
$sth = $con->prepare($sql);
$sth->bindParam(':member', $m_id);
$sth->execute();

while ($row = $sth->fetch(PDO::FETCH_ASSOC)){
echo $row['n_id'];
}

1 个答案:

答案 0 :(得分:0)

请改为尝试:

$sth = $con->prepare($sql);
$sth->execute(array(
    ':member', $m_id
));