Need help with Online count [WEBSITE]

11/01/2015 20:29 laitila#1
Alright so i have a problem with my online count. i use the sapphire 2.2 website

as you see here my world server has 1 player connected but the website doesn't show any players online. this is the script

[Only registered and activated users can see links. Click Here To Register...]

$_CONFIG['allg_user_online'] = @odbc_result(@odbc_exec($odbc_connect, 'SELECT COUNT([MultiServer]) as OnlineCount FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] WHERE [MultiServer] > 1'), 'OnlineCount');


is theres something wrong? please website coders help me
11/01/2015 23:40 Sedrika#2
Change [MultiServer] > 1 to [MultiServer] != 0
11/02/2015 02:22 laitila#3
Quote:
Originally Posted by Sedrika View Post
Change [MultiServer] > 1 to [MultiServer] != 0
Thanks for replying but no it didn't work

$_CONFIG['allg_user_online'] = @odbc_result(@odbc_exec($odbc_connect, 'SELECT COUNT([MultiServer]) as OnlineCount FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] WHERE [MultiServer] != 0'), 'OnlineCount');


what else should i try:/? can it be something wrong in the database?
11/04/2015 00:48 Aspire7730#4
Quote:
$_CONFIG['allg_user_online'] = @odbc_result(@odbc_exec($odbc_connect, 'SELECT COUNT([MultiServer]) as OnlineCount FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] WHERE [MultiServer] != 0'), 'OnlineCount');
Change the red marked != to this > if you still have your Problem
11/13/2015 11:15 XYZ-Cannon#5
Quote:
Originally Posted by Aspire7730 View Post
Change the red marked != to this > if you still have your Problem
[Only registered and activated users can see links. Click Here To Register...]

Doesn't make a difference.
11/13/2015 12:04 xTwiLightx#6
Quote:
Originally Posted by XYZ-Cannon View Post
[Only registered and activated users can see links. Click Here To Register...]

Doesn't make a difference.
It does in logic, because with > 1 there will be only shown the usercount of users in channels greater than 1 (which lots of servers don't even have) - != (or even > 0) is the right choice.

Quote:
Originally Posted by laitila View Post
Thanks for replying but no it didn't work

$_CONFIG['allg_user_online'] = @odbc_result(@odbc_exec($odbc_connect, 'SELECT COUNT([MultiServer]) as OnlineCount FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] WHERE [MultiServer] != 0'), 'OnlineCount');


what else should i try:/? can it be something wrong in the database?
Remove the @'s in that statement (@ suppresses errors in PHP functions) - the query itself looks fine.
11/13/2015 13:08 XYZ-Cannon#7
Quote:
Originally Posted by xTwiLightx View Post
It does in logic, because with > 1 there will be only shown the usercount of users in channels greater than 1 (which lots of servers don't even have) - != (or even > 0) is the right choice.



Remove the @'s in that statement (@ suppresses errors in PHP functions) - the query itself looks fine.
You should look whom I quoted. I said between != 0 and > 0 is no difference in that function.
11/13/2015 15:21 xTwiLightx#8
Quote:
Originally Posted by XYZ-Cannon View Post
You should look whom I quoted. I said between != 0 and > 0 is no difference in that function.
If the MultiServer is negative, e.g. -1 (which won't happen, I know), it will also count. But while programming we should always be precise with what we want to achieve.

So to be exact, there IS a difference, even if it won't be noticed at all.
11/13/2015 15:42 XYZ-Cannon#9
Quote:
Originally Posted by xTwiLightx View Post
If the MultiServer is negative, e.g. -1 (which won't happen, I know), it will also count. But while programming we should always be precise with what we want to achieve.

So to be exact, there IS a difference, even if it won't be noticed at all.
That's why I wrote in this function. Things which will never happen shouldn't be implemented, otherwise you would programm thousands of lines of code for an easy function.