Here's some database call example syntax for you to work with, this should work out of box from a vanilla install of EQEmu Server
Code:
$query = "SELECT
COUNT(id) as count
FROM
character_data
WHERE
(character_data.last_login > UNIX_TIMESTAMP() - 600)
and zone_instance = ?";
$ex = plugin::LoadMysql()->prepare($query);
$ex->execute($realm_instance);
while (@row = $ex->fetchrow_array()){
return $row[0];
}
Here are some other examples too to help you out
Code:
#::: Guild Online Messages :: Only for mains
if ($uguild_id > 0) {
$query = "
SELECT
guild_members.char_id
FROM
guild_members
WHERE alt = 0
and char_id = ?
";
$ex = plugin::LoadMysql()->prepare($query);
$ex->execute($client->CharacterID());
while (@row = $ex->fetchrow_array()) {
quest::gmsay("[Guild] " . $client->GetCleanName() . " is now online", 15, 1, $uguild_id, 0);
}
}
#::: Friend online messages
$query = "
SELECT
character_data.name
FROM
friends
INNER JOIN character_data ON friends.charid = character_data.id
WHERE
friends.name = ?
and friends.type = 1
and (character_data.last_login > UNIX_TIMESTAMP() - 600)
";
$ex = plugin::LoadMysql()->prepare($query);
$ex->execute($client->GetCleanName());
while (@row = $ex->fetchrow_array()) {
quest::crosszonemessageplayerbyname(15, $row[0], "[Friend] " . $client->GetCleanName() . " is now online");
}