Welcome to PCCS-Linux.COM Hello, and welcome to the PCCS-Linux Home Page.
Your last visit was !!!
Your Browser is running on Other
 
Random Tip Srcipt
$ mysqladmin create randomtips -p
$ mysql randomtips
$ randomtips>

-> CREATE TABLE randomtips (
->  id int(11) DEFAULT '0' NOT NULL auto_increment,
->  name varchar(50),
->  email varchar(100),
->  title varchar(200),
->  tipbody longtext,
->  PRIMARY KEY (id),
->  KEY randomtips_id (id),
-> );

$ randomtips> \q

Insert some data into your table...

$ mysql randomtips -p
$ randomtips> INSERT into randomtips VALUES('','authorname','email','tip
title',
-> 'tip body can be alot of text';
$ randomtips>\q

 
<?

$db_host = "localhost";
$db_user = "userid";
$db_passwd = "passwd";

$database = "dbname";


srand(time());
mysql_connect("localhost", "$db_user", "$db_passwd") or die("Unable to
connect to
database");
@mysql_select_db("$database") or die("Unable to select database");
$result = mysql_query("SELECT * FROM randomtips");

$numrows=mysql_num_rows($result);
$random=rand(0,$numrows-1);
mysql_data_seek($result,$random);
$tips=mysql_fetch_array($result);

// echo ($tips["t_stamp"]);
echo "<center><font size=+1 color=red>";
echo ($tips["title"]);
echo "</font></center>";
echo "<P>";
echo ($tips["tipbody"]);

?>


>> Comments/FeedBack


Page hits 116 last request on :04:12



This web site is prepared and maintained by Chauncey Thorn.
The information contained in this site was valid at the time of posting.
Chauncey Thorn, assumes no liability for damages incurred directly or indirectly as a result of errors, omissions or discrepancies.

Remember most of the content here are my notes...

All logos and trademarks in this site are property of their respective owner. All the rest © by PCCS-Linux.COM

PCCS-Linux.COM ::ource Advocate Articles catalogue
2000 2002