[eluser]Rowan Wilson[/eluser]
There are many ways to achieve this.
In your if statement in the foreach loop you don't need the parenthesis around empty().
But otherwise, why not check your result is not empty before trying to loop through it?
e.g.
Code:
if($programmes)
{
foreach($programmes as $row)
{
//..
}
}
else
{
echo 'No Programmes found!';
}