Ok, I've got an online magazine, with little links to the articles. The page I'm having problems with is one that is supposed to show the latest article (by id number and then a random article, choosing from the first article available (id number is 1) to one shy of the latest article. In other words, if the latest article is 16, the random choice should be made between 1 and 15, and it works, except every once in a while I get a broken image and article link, as though it chose no number at all.
Code:
<?php
mysql_connect('sql', 'database', 'password') or die ("Problem connecting to the database");
$query0 = "select id,picon,blurb from features ORDER BY id DESC LIMIT 1";
$result0 = mysql_db_query("themid", $query0);
$row0=mysql_fetch_array($result0);
$nfnumber=$row0[id];
echo ("display $row0 stuff . . .");
$rando=mt_rand(1,($nfnumber--));
$query = "select id,picon,blurb from features where id=$rando";
$result = mysql_db_query("themid", $query);
$row=mysql_fetch_array($result);
echo ("display $row stuff . . ."); ?> I'm sure the problem is either me not understanding RANDO correctly or my use of my $nfnumber variable. But I'm stumped if I can see what it is . . .