I am trying to build a script, which selects a random ID from my MySQL database. The ID's are all integers, ranging from 1 to whatever ID is the last is the database.

I have been trying to get a script running that selects a random number out of this heap of integers. This is what I have so far:

PHP Code:
mysql_connect() or die("Could not connect to database");
mysql_select_db (Jokes$dbx);
$sql "SELECT MAX(id) FROM Jokes";
$result mysql_query($sql);

As you can see, I have a query requesting the maximum ID in the table. I now want to select a random number which has to be between 1 and the maximum id I requested. How would I integrate this in this script?

Thanks in advance .