[PHP] Online User Total

03/18/2012 22:33 Serenduk#1
Im trying to set a php page to display online user total i have the following code:

PHP Code:
<?php
@$connect odbc_connect("Driver={SQL Server};Server={".$host."}; Database={".$db2."}""".$user."""".$pass."") or die("<center><b style=\"border:1px dashed #FF0000;\">".str_replace("[Microsoft][ODBC SQL Server Driver][SQL Server]"""odbc_errormsg())."</b></center>");
@
odbc_result_all(odbc_exec($connect"SELECT TOP (".$show2.") nUserCount as Online FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID DESC"));
echo 
"
                    <b>Server: <span style='color:red'><i>Sro </i></span> - <span style='color:#000'>
$row[nUserCount]</span><span style='color:green'> of maximum</span> <span style='color:#000'>1000</span> <span style='color:green'>are currently online!</span></b>    
                    "
;
        
?>
This code shows a box with total number of user's but im trying to get it to spit out the total where $row[nUserCount] is can anyone point me in the right direction or any script already out there with odbc connection >?

:handsdown:
03/20/2012 15:10 Serenduk#2
any help please ?
03/20/2012 15:45 silkroadnet#3
PHP Code:
<?php 
$host 
"host"//Host
$db2 "SRO_VT_ACCOUNT"//DB
$user "username"//username
$pass "pw";  //pw
$show2 1
@
$connect odbc_connect("Driver={SQL Server};Server={".$host."}; Database={".$db2."}""".$user."""".$pass."") or die("<center><b style=\"border:1px dashed #FF0000;\">".str_replace("[Microsoft][ODBC SQL Server Driver][SQL Server]"""odbc_errormsg())."</b></center>"); 
@
odbc_result_all(odbc_exec($connect"SELECT TOP (".$show2.") nUserCount as Online FROM _ShardCurrentUser WHERE nShardID = 64 ORDER BY nID DESC")); 
echo 

                    <b>Server: <span style='color:red'><i>Sro </i></span> - <span style='color:#000'>
$row[nUserCount]</span><span style='color:green'> of maximum</span> <span style='color:#000'>1000</span> <span style='color:green'>are currently online!</span></b>     
                    "

         
?>
03/20/2012 21:10 Serenduk#4
thats just adding the db connect info im already connecting but as i put it displays stats in a block not in the area required if u test and look