0
後はangularjs POSTリクエストPHP MYSQL構文エラーまたはアクセス違反:1064
$idPerson=$data[0]->persinId;
$StmtQuestionType=connect_db()->query('SELECT a.`question_id` FROM answer a WHERE a.`person_id`=:PersonId');
$StmtQuestionType->bindValue(':PersonId',$idPerson);
$StmtQuestionType->execute();
から渡された私のコード、$data[0]->persinId
ですが、私はERR
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':PersonId' at line 1' in C:\xampp\htdocs\survey\insert.php:11 Stack trace: #0 C:\xampp\htdocs\survey\insert.php(11): PDO->query('SELECT a.`quest...') #1 {main} thrown in C:\xampp\htdocs\survey\insert.php on line 11
'query'ではなく' prepare'ですか? – emaillenin
'query()'は与えられたクエリを直ちに実行します。代わりに、 'prepare()'、 'bind()'、 'execute()'を使いたいとします... – arkascha
'$ StmtQuestionType = connect_db() - > query( 'SELECT a.'question_id'誰かがどこにいるのかを知るためには、 '' Person'' == PersonID = ':PersonId'' =' PersonId'' = 'PersonId'')' 'StmtQuestionType = connect_db() –