Try:
PHP Code:
$query = "SELECT erc_content.*, erc_contenttype.contenttype
FROM erc_content
LEFT JOIN erc_contenttype ON erc_content.contentid = erc_contenttype.contenttypeid
" . ($_GET['contenttypeid'] ? "AND erc_content.contenttypeid = '" . $_GET['contenttypeid'] . "'" : '') . "
ORDER BY erc_contenttype.displayorder, erc_content.displayorder";
$contents = $db->query_first($query);
Although... your query looks wrong to me - it doesn't have a WHERE clause in it
Also, you shouldn't use $_GET[] directly within the query, clean it using the input_cleaner class first
Oh, and don't forget table prefixes!
Thanks,
Alan.