Septharoth Posted December 22, 2014 Share Posted December 22, 2014 <?php include 'core/classes/Query.php'; include 'core/functions/recaptchalib.php'; $sqlQ = "SELECT * FROM `servers`"; $qResult = $database->query($sqlQ); $i = 0; while ($row = $qResult->fetch_assoc()) { $query = new Query($row['address'], $row['query_port'], $row['engine']); $info = $query->query(); if(!$info) { $info = $query->return_false(); } $details = array( 'players' => $info['players'], 'details' => $info['details'] ); $details = json_encode($details); $update = $database->prepare("UPDATE `servers` SET `status` = ?, `online_players` = ?, `maximum_online_players` = ?, `map` = ?, `details` = ?, `cachetime` = unix_timestamp() WHERE `server_id` = {$row['server_id']}" $update->bind_param('sssss', $query->status, $info['general']['online_players']['value'], $info['general']['maximum_online_players']['value'], $info['general']['map']['value'], $details) $update->execute(); } ?> What I'm trying to accomplish is query every server & update every one of the rows for each server listed. This does nothing ( its a cronjob , as it has to run every 5 minutes , newbie so not entirely sure if this is event the right approach ) Quote Link to comment https://forums.phpfreaks.com/topic/293228-querying-every-server-listed-in-the-sql/ Share on other sites More sharing options...
Solution Septharoth Posted December 22, 2014 Author Solution Share Posted December 22, 2014 NEVERMIND! figured it out :3 Quote Link to comment https://forums.phpfreaks.com/topic/293228-querying-every-server-listed-in-the-sql/#findComment-1500346 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.