Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Make a MySQL Connection
- mysql_connect("127.0.0.1", "root", "ascent") or die(mysql_error());
- mysql_select_db("world") or die(mysql_error());
- // Get all the data from the "example" table
- $escaped_string = mysql_real_escape_string($_GET['dispname']);
- $result = mysql_query('SELECT displayid, name FROM item_template WHERE name LIKE "%' . $escaped_string . '%"')
- or die(mysql_error());
- $rows = array();
- while($row = mysql_fetch_assoc($result)) {
- $rows[] = array('name' => $row['name'], 'id' => $row['displayid']);
- }
- header('Content-Type: application/json');
- echo json_encode($rows);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement