i have this query below but i want to be able to do this without concatenating the query, when i concatenate the query i get a mysql_fetch _array error, is there anyway of doing this or does it need to be concatenating becuase of the php if statement thats applied.
an answer for this will be much appreciated.
$query = "SELECT `post`. `id` AS `post_id`, `categories`. `id` AS `category_id`,
`title`, `content`, `date_post`, `categories`.`name` FROM `post` INNER JOIN `categories` ON `categories`. `id` = `post`. `cat_id`";
if(isset($id)){
$query .= "WHERE `post`.`id` = '$id'";
}