Creating a random link generator
The random generator code that this generator uses was originally posted to the PHP mailing list. View the original: Retrieve random Sql results
SQL for links table:
# Table structure for database table 'links'
#
CREATE TABLE links (
id tinyint(5) DEFAULT '0' NOT NULL auto_increment,
name char(250) NOT NULL,
url char(250) NOT NULL,
alt char(250) NOT NULL,
PRIMARY KEY (id)
);
PHP Code:
<?php
$db = mysql_connect("server", "username", "password");
mysql_select_db("database",$db) or die ("Unable to connect to database");