View Full Version : Random text genrator
GoldenMerc
27-11-2008, 04:26 PM
Hey,
Im wanting a system where it gives a random quote every 2 mins I need it to be able to use with a panel, so i think it would have to add the the database then pick up from the database in the page?
Ross
<?php
include("config.php"); // your database connection, change as necessary.
$amount = mysql_num_rows(mysql_query("SELECT * FROM `quotes`"));
$rand = rand(1,$amount);
$query = mysql_query("SELECT * FROM `quotes` LIMIT $rand, 1;");
$fetch = mysql_fetch_array($query);
echo( $fetch['quote'] );
echo("<meta http-equiv='refresh' content='120;url=".$_SERVER['PHP_SELF']."'>");
?>
I'm hoping that works. Obviously change table names, db connections etc as necessary.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.