0

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 :)

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by chrishea
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.