如何在两个文档中同时从MySQL获取相同的Random()数据?

Right this is tough one for me and I can't figure it out. I have 2 .php files (one with iframe other with comment. so lets call them iframe.php and comment.php respectively).

In iframe.php file I get random url from database and put it as src of <iframe>:

$sql = mysql_query("SELECT url FROM address_book ORDER BY RAND() LIMIT 1")

In comments.php file I get random url from same database table:

$sql = mysql_query("SELECT comment FROM address_book ORDER BY RAND() LIMIT 1")

Then on index.php page I have button:

<button id="nextfLuky" onClick="viewNext();return false;">Randomize</button>

This button calls following javascript function that inserts from iframe.php file into <div id="iframe"></div> (located in index.php page). And comment from comment.php file is also inserted in <div id="comment"></div> (Also located in index.php file)

And this is javascript called by <button>

function viewNext()
{
$("#iframe").load("iframe.php");
$("#coment").load("coment.php");
}

The problem is that I need to get url and comment that are related to each other from database (I can do it if I use one .php file, but I need to use two). And as I get them randomly in two different files they are not related to each other, when displayed in index.php file.

So how can I get url and comment that are related to each other if I get each one randomly in two different files?

Addition: Database Table Structure

______________________________________
id       |int(11)      |Auto Increment
______________________________________
url      |varchar(255)
______________________________________
comment  |text(1000)
______________________________________

Okay if you prefer JQuery I am replacing the XmlHttp solution with one made with jquery. Check it out out how the information is passed, I think is not difficult to adjust it to your needs.

You only have to create a getUrl.php file to get the url (I have created one for testing purposes). iframe.php and comment.php will remain intact, *just make sure they get the random url from $_GET['url'].*

Again I notice this is a solution according to your current design, not a general or best one.

To test it, let's say this is index.php (you only need the viewNext() from here the other code is for testing):

<html>
<head>
<script type="text/javascript" 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>

<script type="text/javascript"> 

function viewNext()
{ 
$.get("getUrl.php",null, 
            function(responseText)
            {   $("#iframe").attr('src', 'iframe.php?url='+responseText); 
                $("#comment").load('comment.php','url='+responseText);
            }
);//load ends
}//viewNext ends

</script>
</head>
<body onload="viewNext()">
<input type=submit value=next id="mySubmit" onclick="viewNext()"><br>
<IFRAME  id="iframe" WIDTH=450 HEIGHT=100>
Ybrowser doesn't show IFRAME.  
</IFRAME>
<div id="comment"></div>
</body>
</html>

Then this is iframe.php (with testing code):

<?PHP
echo 'Hello from <font color=red>iframe.php</font> I got the url, here it is:<br>
<font color=blue>',$_GET['url'],'</font>';
?>

Then this is comment.php (with testing code):

<?PHP
echo 'Hello from comment.php I got the url, here it is:<br>
<font color=blue>',$_GET['url'],'</font>';
?

And finally getUrl.php (copy paste -or include- your code to get random url here and just echo it!):

<?PHP
echo 'http://www.url',rand(1,9999),'.com';
?>