반응형
이 코드는 오류를 발생시키지 않지만 쿼리는 실패합니다. 즉, execute
메서드가 false를 반환합니다. 어떻게 그럴 수 있습니까?
require_once("Abstracts/DBManager.php");
require_once("UI/UI.Package.php");
class BlogDBM extends DBManager
{
private $table = "blog_records";
function saveRecord($title,$url,$desc,$feedId,$pubDate)
{
$PDO = $this->db->connect();
try
{
$query = $PDO->prepare("
INSERT INTO ".$this->table."
(title,url,desc,feed_id,pubdate) VALUES
(:title,:url,:desc,:feed_id,:pubdate)");
$query->bindParam(":title", $title);
$query->bindParam(":url", $url);
$query->bindParam(":desc", $desc);
$query->bindParam(":feed_id", $feedId, PDO::PARAM_INT);
$query->bindParam(":pubdate", $pubDate, PDO::PARAM_INT);
$query->execute();
//return $PDO->lastInsertId();
} catch(PDOException $e)
{
echo "Error " . $e->getMessage();
}
$PDO = NULL;
}
}
해결 방법
참조 페이지 https://stackoverflow.com/questions/2518354
반응형
'MySql' 카테고리의 다른 글
MySQL ImportError : 큐라는 모듈이 없습니다. (0) | 2020.12.02 |
---|---|
MySQL JPA- 엔티티가 아닌 클래스의 두 테이블 결합 (0) | 2020.12.02 |
MySQL-mysqldump-루틴은 모든 루틴이 아닌 하나의 저장 프로 시저 (이름 별) 만 내보내는 루틴 (0) | 2020.12.02 |
MySQL 구문 분석 오류 : 구문 오류, 예기치 않은 'INTO'(T_STRING) 7 행 (0) | 2020.12.02 |
MySQL MAMP Pro에서 Apache가 시작되지 않음 (0) | 2020.12.02 |
댓글