function SendNotificationToNextAttacker($clanID) { $db = new BaseDB(); $sql = "\n SELECT p.GameName, gcmu.gcm_regid\n FROM dbo.OurParticipant AS op INNER JOIN\n dbo.Player AS p ON op.PlayerID = p.PlayerID INNER JOIN\n dbo.gcm_users AS gcmu ON p.GameName = gcmu.game_name\n WHERE op.NextAttacker = 1 AND ClanID = {$clanID}\n "; $result = $db->dbQuery($sql); while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_BOTH)) { $registatoin_ids[0] = $record['gcm_regid']; $msg = array("data" => "cal" . $record['GameName'] . " it is your turn to attack!"); send_push_notification($registatoin_ids, $msg); } $db->Free($result); $db->close(); }
<?php include_once "BaseClasses/BaseDB.class.php"; include_once "BaseClasses/Database.class.php"; $warID = $_REQUEST['selectedWarID']; $db = new BaseDB(); $sql = "\n select GameName,\n CASE FirstAttack\n WHEN 1 THEN 'First'\n WHEN 0 THEN 'Second'\n END AS Attack,\n StarsTaken,\n OurRank,\n TheirRank\n FROM View_WarProgress\n WHERE WarID = {$warID} AND OurAttack = 1 ORDER BY OurRank ASC, FirstAttack DESC\n "; $records = $db->dbQuery($sql); $data = array(); $i = 0; if (!$records) { $data['stats'][0] = array('GameName' => '', 'Attack' => '', 'StarsTaken' => 0, 'OurRank' => 0, 'TheirRank' => 0); } else { while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_BOTH)) { $data['stats'][$i] = array('GameName' => $record['GameName'], 'Attack' => $record['Attack'], 'StarsTaken' => $record['StarsTaken'], 'OurRank' => $record['OurRank'], 'TheirRank' => $record['TheirRank']); $i++; } } $db->Free($records); $db->close(); echo json_encode($data);
$records = $dbBaseClass->getFieldsByFilter('Company', array('id', 'Name', 'CompanyCode', 'Active', 'ShortName'), "WHERE Name LIKE '%{$bc}%'"); } else { $records = $dbBaseClass->getFieldsForAll('Company', array('id', 'Name', 'CompanyCode', 'Active', 'ShortName')); } if ($records === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } //$numFields = sqlsrv_num_fields($records); echo "<table class='withBorder'>"; echo '<thead>'; echo '<tr></tr><th>Name</th><th>Company Code</th><th>Active</th><th>ShortName</th><th colspan="3">Action</th> <tr></tr>'; echo '<tr>'; echo '</tr>'; echo '</thead>'; while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_BOTH)) { echo "<tr>"; echo "<td>{$record['Name']}</td>"; echo "<td>{$record['CompanyCode']}</td>"; echo "<td>{$record['Active']}</td>"; echo "<td>{$record['ShortName']}</td>"; echo "<td><a href=Company.php?action=r&id={$record['id']}><img src=\"images/icons/view.png\" /></a></td>"; echo "<td><a href=Company.php?action=u&id={$record['id']}><img src=\"images/icons/edit.png\" /></a></td>"; echo "<td><a href=Company.php?action=d&id={$record['id']}><img src=\"images/icons/delete.png\" /></a></td>"; echo "</tr>"; } echo "</table>"; $dbBaseClass->close(); ?> </body>