Thread: Links to ID's
View Single Post
  #8  
Old 12-26-2004, 11:16 AM
careless_guest
Unregistered

Posts: n/a

carelessrabbit@hotmail.com for more help :p

1st of all ditch the my_row stuff

use::

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query("SELECT * FROM news order by id DESC LIMIT 7");
$result = mysql_query($query) or die (mysql_error());
$num = mysql_num_rows($result);
mysql_close();
$i=0;
while ($i < $num) {
$title=mysql_result($result,$i,"title");
$date=mysql_result($result,$i,"date");


WHATEVER

$i++;
}
}
if(mysql_num_rows($result) == 0)
{
echo "<strong>There are currently no news articles in the database!</strong>";
}

?>


just i hate using your method of SQL grabbin
Reply With Quote