コード例 #1
0
 public function countComment($diary_id)
 {
     if (empty(self::$conn)) {
         self::$conn = $this->connectPdo();
     }
     $sql = "SELECT COUNT(content) FROM comment WHERE diary_id=?";
     $stmt = self::$conn->prepare($sql);
     $stmt->bindParam(1, $diary_id);
     $dem = $stmt->execute();
     $dem = $stmt->fetchColumn();
     return $dem;
 }