If you have the /usr/local/lib/php.ini set up for asp_tags = on then you can use asp tags in PHP, this helps with editors that don't understand <?php ?> tags.Here is a ruff idea of what you wan't, If I can have access to the DB (select only), I can polish the code.
<?php
//Declare variables
$random = 0;
$record_count = 0
//Open connection to MySQL DB and select DB
$db_conn = mysql_connect("host", "user", "passwd");
mysql_select_db("<db_name>");
//Execute a select all query to get all records - needed to cound records
$result = mysql_query("SELECT * FROM <tablename>");
//Get the count of records for a given result.
$record_count = mysql_num_rows($result);
//Generate random number with 1 fr min and $record_cound for max
$random = mt_rand(1, $record_count)
//Fetch result data and cast into an object (easy to advance records)
$data = mysql_fetch_object($result);
while($data != $random){
$data++;
}
//Ouput data - Note: since data is an object you reference the $data abject we
//created, and associated fields by $date-><field name>
print($data->Field_Name_01);
print($data->Field_Name_01);
mysql_close($conn);
?>
You can also use mysql_data_seek($result, $random) to get the random row, and then issue $data = mysql_fetch_object($result); This will speed script time. Email me for furthur questions.
------------------
Wine me, dine me, 1000101 me
This message has been edited by whtdrgn_2 on January 23, 2001 at 11:25 AM