php/mysql에서 스크립트에 문제가 있습니다. 여기 서버에 표시되는 오류입니다 :php 및 mysql의 치명적인 오류
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 'if exists (select * from notificacoes where uid in() order by id desc' at line 1' in C:\wamp\www\bigui\classes\Notificacoes.class.php on line 57
은 여기 내 PHP 코드 : MySQL의에서
static function listar(){
$strIdAmigos = Amizade::$strIdAmigos;
$query = self::getConn()->query('select * from notificacoes where uid in ('.$strIdAmigos.') order by id desc');
return $query->fetchAll(PDO::FETCH_ASSOC);
}
내 테이블이없는 값, 비어 있습니다. 내가 값을 삽입하면 오류가 사라지고 모든 것이 잘됩니다. 어떤 도움?
'$ strIdAmigos'의 값은 무엇입니까? 어떻게 계산됩니까? 오류 때문에 비어있는 것 같습니다. – Mureinik
[MySQL에서 예약어를 테이블 또는 열 이름으로 사용하기 때문에 구문 오류가 발생할 수 있습니다] (http://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved-word -as-a-table-or-column-name-in-mysql) –