can any one know a rambom sql like rambom link ??
i need for my new toplist im making
i need for my new toplist im making
$random_row = mysql_fetch_row(mysql_query("select * from YOUR_TABLE order by rand() limit 1"));
$random_row = mysql_fetch_array(mysql_query("select * from YOUR_TABLE order by rand() limit 1"));
CREATE TABLE `links` ( `id` int(11) NOT NULL auto_increment, `link` text NOT NULL, `image` longtext NOT NULL, `text` text NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM;
// insert values into the database insert into links values ('NULL',"http://www.site1.com", "path/image.gif", "website description"); insert into links values ('NULL',"http://www.site2.com", "path/image.gif", "website description"); insert into links values ('NULL',"http://www.site3.com", "path/image.gif", "website description");
<?
// Connect to the database
mysql_connect ('localhost', 'username', 'password');
mysql_select_db ('database_name');
// Edit this number to however many links you want displaying
$num_displayed = 3;
// Select random rows from the database
$result = mysql_query ("SELECT * FROM links ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "<a href=\"" . $row["link"] . "\">
<img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\">
</a>";
}
?>
Comment