Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stats Display

Status
Not open for further replies.

bentleykf

Programmer
Apr 29, 2002
59
AU
I want to create a statistics display with MySQL and php. I've already got a script that grabs page hits from a page and puts that into a MySQL table. What I want to do now is to create a script that displays the top 10 pages from that MySQL table, how would I go about acheiving this?
-bentley k. frog
 

$host = "urhostname" ;
$username = "mysqlusername" ;
$password = "urpassword" ;
mysql_connect($host,$username,$password) ;

mysql_select_db("dbname") ;

$sql = "select * from tablename order by pagehits LIMIT 10" ;

$result = mysql_query($sql) ;

whille ($row = mysql_fetch_array) {

$field1 = $row["field1"] ;
$field2 = $row["fiels2"] ;
..

echo $field1 ;
echo $field2 ;
}

mysql_close() ;



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top