Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('../../Configuration.php');
- $conn = mysqli_connect($host, $dbuser, $dbpass, $chardb);
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql = "SELECT guid, name FROM characters";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- while($row = mysqli_fetch_assoc($result)) {
- if(isset($_POST['guid'])) {
- echo json_encode(
- array(
- array('id' => $row['guid'], 'name' => $row['name']),
- array('id' => $row['guid'], 'name' => $row['name']),
- array('id' => $row['guid'], 'name' => $row['name']),
- )
- );
- }
- }
- } else {
- echo "...";
- }
- header('Content-Type: application/json');
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement