View Single Post
Old 01-11-2005, 02:03 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,544
sde is on a distinguished road
well it is possible that you don't have an article for EVERY id in the table, so i'd recommend using the mysql random function in your second query.
PHP Code:
<?
mysql_connect
('sql''database''password') or die ("Problem connecting to the database");

$result mysql_query("select id,picon,blurb from features order by id desc limit 1";

if(
$row mysql_fetch_array($result)){
  
$nfnumber $row['id'];
  
  
// display latest article here
  
  
$result2 mysql_query("select id,picon,blurb from features 
                          where id != "
.$nfnumber." order by rand() limit 1");
                          
  if(
$row2 mysql_fetch_array($result2)){
    
// display random article here
  
}
}

mysql_close();
?>
__________________
Mike
sde is offline   Reply With Quote