I am using the following query:-
SELECT n.id, n.title, n.time, n.news, n.type, m.name FROM looneysbin.news n, ibf_looneys.ibf_members m where type = 1 AND m.id = n.staff_id OR n.type = 2 AND m.id = n.staff_id OR n.type = 3 AND n.latest_update = 1 ORDER BY id DESC LIMIT 15
And then the following bit of coding to output the selected rows:-
WHILE($this->row = $driver->fetch_row())
{
$this->row['time'] = $fun->display_date(array('time' => $this->row['time']));
if($this->row['type'] != 3)
{
if(strlen($this->row['news']) > $setting['snip_length'])
{
$this->row['news'] = substr($this->row['news'], 0, $setting['snip_length']);
$this->row['news'] .= "....";
}
$this->output .= $this->skin->select_news(array('row' => $this->row, 'lang' => $this->lang));
}else
{
$this->output .= $this->skin->updated_news_display(array('row' => $this->row, 'lang' => $this->lang));
}
}
But I have noticed a problem once the row with type 3 field in and the latest update is set to 1. It gets that row 4 times. I have checked the table and the require row is only in there once.
So does anybody know what I have done wrong with the query?