SELECT max(id)
FROM table1;
That is the query to get the max id.
// Assuming that you've placed max id into varible $maxID
$randomID = rand(1, $maxID);
That uses the [man]rand/man function to get a random integer between 1 and the $maxID.
$sql = "SELECT id, image1, title
FROM table1
WHERE id = " . $maxID;
That is the query you will build to get your information.