|
Done, thanks for 1776 for script.
- I would have done this myself in a second, but I have so confusing plans which aren't maybe using the best ways to do things
so I thought it would be more difficult as I didn't think I could do it by normal script which loads data from MySQL database.
Code:<?php $serverRank = 0; While(true) { $serverRank++; } $db_host = ""; $db_user = ""; $db_pass = ""; $db_host = "" if (!@mysql_connect($db_host, $db_user, $db_pass)) { die("error connecting to database: " . mysql_error()); } if (!@mysql_select_db($db_name)) { die("error selecting database: " . mysql_error()); } $query = mysql_query("SELECT * FROM `table` ORDER BY `serverVotes` DESC;"); if(mysql_num_rows($query) > 0) { while($results = mysql_fetch_assoc($query)) { echo $serverRank . " - " . $results['serverName'] . " - " . $results['serverVotes']; $serverRank++; } } ?>
Lmao.. Anyways, this can get you started.
Code:CREATE TABLE IF NOT EXISTS `servers` ( `id` int(11) NOT NULL AUTO_INCREMENT, `server_name` varchar(32) COLLATE latin1_general_ci NOT NULL, `votes` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;This should work, writing it while playing xbox xDCode:$query = mysql_query("SELECT * FROM servers ORDER BY votes DESC") or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { $id = $row['id']; $name = $row['server_name']; $votes = $row['votes']; echo 'Server name:'.$name.' has '.$votes.' votes <br />'; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |