First, If there are less than 3 records, this ASP code will print records twice/thrice.
Second, manuals really are your friends, I keep telling everybody, but nobody listens.. 🙂
All this ASP code does is move to a random record in the resultset,
print the current record,
move to the next record,
If there is no next record, move to the first record,
print the current record,
move to the next record,
If there is no next record, move to the first record,
print the current record.
So it prints a sequence of three records from a random starting location.
(it does not print three random records)
In PHP, use mysql_data_seek to move to a random record in your resultset.
print the record.
Check if the current record is the last record (mysql_num_rows())
If it is the last record, mysql_data_seek() to the first record
etc.