I got it wrong, thank you.
This issue has been turned off because of an issue where the exact result cannot be obtained
Reply content:
I got it wrong, thank you.
bindParamPDOStatementthe way you are, PDO of course you can't find it.
PDOStatementIs PDO::prepare() the return object, do not know where you go to see the code, the PDO object name $stmt , and do not get ->prepare() back PDOStatement .
$pdo = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);//先新建一个PDO$pdo->->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//开启PDO的报错$sql = 'SELECT * FROM article WHERE id > ?';try{ $stmt = $pdo->prepare(sql);//返回的statment的值赋给$stmt $stmt -> bindParam(要绑定的占位符的位置, 要绑定的变量 [, 数据类型]);//bindParam()是$stmt的方法而不是$pdo的方法 $stmt -> execute();//执行sql语句} catch (PDOException $e) { echo 'Execute SQL failed: ' . $e->getMessage(); exit(); }
It should be like this.