Newbie Spellweaver
- Joined
- Feb 24, 2014
- Messages
- 21
- Reaction score
- 0
SELECT SUM(`UserCount`) FROM
(
SELECT
`UserCount`
FROM
`concurrentuser`
WHERE `Time` =
( SELECT
MAX(`Time`)
FROM
`concurrentuser`
WHERE `ServerPort` = '8360')
UNION
SELECT
`UserCount`
FROM
`concurrentuser`
WHERE `Time` =
( SELECT
MAX(`Time`)
FROM
`concurrentuser`
WHERE `ServerPort` = '8361')
) cnt
afterUNION SELECT
`UserCount`
FROM
`concurrentuser`
WHERE `Time` =
( SELECT
MAX(`Time`)
FROM
`concurrentuser`
WHERE `ServerPort` = '836x')
in the current queryWHERE `ServerPort` = '8361')
mysql_select_db('gunbound');
$query = "SELECT SUM(`UserCount`) ol FROM (SELECT `UserCount` FROM `concurrentuser` WHERE `Time` = ( SELECT MAX(`Time`) FROM `concurrentuser` WHERE `ServerPort`='8360')) cnt GROUP BY `UserCount`;";
$result = mysql_query($query, $conn );
if (!$result) exit("The query did not succeded");
else {
while ($row = mysql_fetch_array($result)) {
echo "Online: "+ $row['ol'];
}
}
use this one<?php
$servername = "localhost";
$username = "root";
$password = "";
$conn = mysql_connect($servername, $username, $password);
// Check connection
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('gunbound');
$query = "SELECT SUM(`UserCount`) ol FROM (SELECT `UserCount` FROM `concurrentuser` WHERE `Time` = ( SELECT MAX(`Time`) FROM `concurrentuser` WHERE `ServerPort`='8360')) cnt GROUP BY `UserCount`;";
$result = mysql_query($query, $conn );
if (!$result) exit("The query did not succeded");
else {
while ($row = mysql_fetch_array($result)) {
echo "Online: ". $row['ol'];
}
}
?>
<?php
$servername = "XXX.XXX.XXX.XXX";
$username = "root";
$password = "XXXXXXXX";
$conn = mysql_connect($servername, $username, $password);
// Check connection
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('gunbound');
$query = "SELECT SUM(`UserCount`) ol FROM (SELECT `UserCount` FROM `concurrentuser` WHERE `Time` = ( SELECT MAX(`Time`) FROM `concurrentuser` WHERE `ServerPort`='8360')) cnt GROUP BY `UserCount`;";
UNION
SELECT `UserCount` FROM `concurrentuser` WHERE `Time` = ( SELECT MAX(`Time`) FROM `concurrentuser` WHERE `ServerPort`='8361') cnt GROUP BY `UserCount`;
$result = mysql_query($query, $conn );
if (!$result) exit("The query did not succeded");
else {
while ($row = mysql_fetch_array($result)) {
echo "Online: ". $row['ol'];
}
}
?>