noob,
You're gonna have to supply a little more information. How have you debugged it so far? Have you tried echoing any of the variables to the screen? Is your other data ok? What are you trying to accomplish?
Showing us your code and simply stating that it's showing "all of them are offline or all of them are online" doesn't tell us much -- which is it, and when? Is it random?
It sounds like you might not be getting the data you expect from your queries. Try running them on your SQL server to make sure they work correctly.