Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $online = 0; //leave this alone
- $horde = 0; //leave this alone
- $alliance = 0; //leave this alone
- $host = "localhost"; //MySQL host
- $user = "root"; //MySQL use
- $pass = "ascent"; //MySQL pass
- $char_db = "characters"; //database containing the 'characters' table.
- $con = mysql_connect($host, $user, $pass) or die("Could not connect to MySQL" . mysql_error($con));
- mysql_select_db($char_db, $con) or die("Could not select MySQL database" . mysql_error($con));
- $query = mysql_query("SELECT * FROM characters WHERE online = '1'", $con);
- while($list = mysql_fetch_array($query)){
- $online = $online + 1;
- if($list['race'] == 2 || $list['race'] == 5 || $list['race'] == 6 || $list['race'] == 8 || $list['race'] == 10){
- $horde = $horde + 1;
- } else {
- $alliance = $alliance + 1;
- }
- }
- if($online == 0){
- echo "There are no players online";
- } else {
- echo "There are a total of " . $online . " players online. " . $horde . " are Horde, and " . $alliance . " are Alliance.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement