Jump to content

[SOLVED] Generate DB data in a page


McChicken

Recommended Posts

Try this and modify where needed

 

<?php
$username = "yourusername";
$password = "yourpassword";
$hostname = "yourhostname";	
$dbh = mysql_connect($hostname, $username, $password) 
or die("Unable to connect to MySQL");
$selected = mysql_select_db("yourdatabasename",$dbh) 
or die("Could not get database");
$result = mysql_query("SELECT * FROM ip_hits ORDER BY clicks, date DESC LIMIT 0,10");
//while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<table cellspacing='15'>";
echo "<tr><td colspan='3'><hr /></td></tr>";
while($row = mysql_fetch_assoc($result))
{
extract ($row);
echo "<tr>\n
<td>$id</td>\n
<td>$clicks</td>\n
<td>$ip</td>\n
<td>$BrukerID</td>\n
<td>$date</td>\n
</tr>\n";
echo "<tr><td colspan='3'><hr /></td></tr>\n";
}
echo "</table>\n";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.