不会在 PDO 语句中prepare()
转义任何内容吗?quotes(')
出于某种原因,当我这样做时:
$sql = "INSERT INTO sessions (id, name) VALUES (1,'O'brian')";
$query = $this->connection->prepare($sql);
$query->execute();
我收到此错误:
Could not insert record SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near 'brian'.
如果我正在使用,这怎么可能prepare()
?