カテゴリー:
Parse error
閲覧数:708 配信日:2014-10-21 09:10
エラーメッセージ
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /〇〇.php on line △△
エラー箇所
public function fetchAllById($id)
{
$sql = "
SELECT a.* , u.display_name, u.site_id, c.category
FROM elem a
LEFT JOIN user u ON u.id = a.user_id
LEFT JOIN category c ON a.category_id = c.category_id
WHERE a.entry_id = :id
ORDER BY a.created_at ASC
";
return $this->fetchAll($sql, array(
':id' => $id
);
エラー原因
・最後の } が足りない
エラー修正
public function fetchAllById($id)
{
$sql = "
SELECT a.* , u.display_name, u.site_id, c.category
FROM elem a
LEFT JOIN user u ON u.id = a.user_id
LEFT JOIN category c ON a.category_id = c.category_id
WHERE a.entry_id = :id
ORDER BY a.created_at ASC
";
return $this->fetchAll($sql, array(
':id' => $id
);
}