Hey guys I have a small piece of code and I'm just wondering how to go about doing the following.

All the script does is gets random information from a database every time the user clicks a link. Which works fine, but the problem is the script is getting information when the page is refreshed, I want the information to change ONLY when the user clicks the link.

Here's the code:

if($_GET['act'] == "char_con") 
    {
        $con = mysql_connect("#", "#", "#");
        if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
        mysql_select_db("quote", $con);
        $result = mysql_query( ' SELECT * FROM `quote`  ORDER BY RAND() LIMIT 0,1 ' );
        while($row = mysql_fetch_array($result))
    {
        echo '' . $row['q_quote'] . '';
    }
        mysql_close($con);
        echo '';    
    }
        else 
    {
    echo '';
}
?>

And the link that fetches the information:

<a href="index.php?act=char_con&amp;beginCount&amp;cb=%3C?php%20echo%20time();?%3E">
     LINK
</a>';

Just wondering if there's a way to go about doing this? Never done anything like it so any advice would be appreciated,

Thanks for any info.

PS - Merry Christmas :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.