vForums Support > vForums :: Report a Bug :: Resolved Bugs :: > API Array Printing Error

API Array Printing Error - Posted By dog199200 (dog199200) on 10th Aug 09 at 10:54pm
URL: http://www.divineshadowsonline.com
Browser: FF

For some reason the API just keeps printing out a C when trying to call forum information. Was something changed in how the array is suppos to be formaed cause this is what i currently have:

Code:
 
  1. <?php
  2. $users_online = $vforums_api -> request("api/info/online/1/stats/0");
  3. echo "Total Players: " . $users_online['total_members'];
  4. ?>
 

Re: API Array Printing Error - Posted By Ross (admin) on 11th Aug 09 at 1:13am
Give it a try now. I recently updated some of the server file structure and thought I had updated all of the API files to reflect this. Apparently I missed one of the functions used by this API module. You can always check exactly what is being returned by doing a print_r() on the array. eg.

print_r($users_online);

Re: API Array Printing Error - Posted By dog199200 (dog199200) on 11th Aug 09 at 3:20am
OK i printed all of the major arrays and i can't find the array with the "total_members" in it. Its not in $users_online anymore, or at least it doesn't come up when calling its array.

Re: API Array Printing Error - Posted By Ross (admin) on 11th Aug 09 at 5:08pm
Hi Dwight,

The API request you are doing there specifies the "stats" parameter as "0" (ie. false) therefore it doesn't fetch that information and only returns information about the current users online.


Code:
 
  1. <?php
  2. $users_online = $vforums_api -> request("api/info/online/1/stats/1");
  3. echo "Total Players: " . $users_online['total_members'];
  4. ?>
 

Re: API Array Printing Error - Posted By dog199200 (dog199200) on 11th Aug 09 at 10:08pm
oh oops i forgot to change the 0. Ok thank you.

Edit: after the C vanished i now can't print the array and nothing in the user online is working, but yet the login checking system is still working.

Re: API Array Printing Error - Posted By dog199200 (dog199200) on 13th Aug 09 at 12:27am
I found out that for some reason you can't have Online functions and forum stat functions active at the same time, even if you split them in different php calls, the first call is what is activated.