Guest User

Untitled

a guest
Feb 6th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. $inputText = $_POST['inputText'];
  2. $inputText = str_replace(' ','%', $inputText);
  3. $servername = '***';
  4. $username = '**';
  5. $password = '***';
  6. $db_name = "**";
  7. $conn = mysqli_connect($servername, $username, $password, $db_name);
  8. if (!$conn) {
  9.     die("Connecion failed: " . mysqli_connect_errno());
  10. }
  11. $result = mysqli_query($conn,"SELECT search_description,link,img_link FROM motozone_search
  12. WHERE search_description LIKE '%$inputText%'  LIMIT 10");
  13. $response = array();
  14. while($row = mysqli_fetch_assoc($result)){
  15.     $response[] = $row;
  16. }
  17.  
  18. print json_encode($response);
  19. mysqli_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment