A wee bit of alteration:
$now = time();
$notice = 86400 * 5;
while ($row = mysql_fetch_array(result))
if ($row['endtime'] && $now < $row['endtime'] - $notice) echo '...';
You might want to put setting $now and $notice outside of the loop to be more efficient as well as check to see if $row['endtime'] has a value, other than that, looks straightforward to me.
Phil
Phil