Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-Type: text/html; charset=utf-8');
- if ( !isset($_REQUEST['term']) )
- exit;
- include 'includes/config.php';
- $rs = mysql_query('SELECT * FROM `news` WHERE `title` LIKE "%'. mysql_real_escape_string($_REQUEST['term']) .'%" ORDER BY id DESC LIMIT 0 , 10');
- $data = array();
- if ( $rs && mysql_num_rows($rs) )
- {
- while( $row = mysql_fetch_array($rs) )
- {
- $data[] = array(
- 'label' => htmlspecialchars_decode($row['title']),
- 'value' => htmlspecialchars_decode($row['title'])
- );
- }
- }
- echo json_encode($data);
- flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement