Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //fetch.php
- if(isset($_POST["query"])){
- $connect = mysqli_connect("private", "private", "private", "private");
- $request = mysqli_real_escape_string($connect, $_POST['query']);
- $query = "
- SELECT * FROM search_product
- WHERE produktnamn LIKE '%".$request."%'
- OR specifikationer LIKE '%".$request."%'
- ";
- $result = mysqli_query($connect, $query);
- $data = array();
- $html = '';
- $html .= '
- <table class="table table-bordered table-striped">
- <tr>
- <th>Name</th>
- <th>Specifications</th>
- </tr>
- ';
- }
- }if(mysqli_num_rows($result) == 0){
- $data = 'No Data Found';
- $html .= '
- <tr>
- <td colspan="3">No Results Found</td>
- </tr>
- ';
- }
- $html .= '</table>';
- if(isset($_POST['typehead_search']))
- {
- echo $html;
- }
- else
- {
- array_unique($data);
- echo json_encode($data);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement