Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'conn.php';
- if(ISSET($_POST['search'])){
- //$query = $conn->query("SELECT * FROM `member` WHERE (`lastname` LIKE '%".$_POST['search']."%') OR (`city` LIKE '%".$_POST['search']."%') ");
- $query = $conn->query("SELECT * FROM `member` WHERE (`firstname` LIKE '%".$_POST['search']."%') OR (`lastname` LIKE '%".$_POST['search']."%') OR (`city` LIKE '%".$_POST['search']."%') OR (`postal_code` LIKE '%".$_POST['search']."%') ") ;
- $row = $query->num_rows;
- if($row > 0){
- $output = "";
- $output .= "
- <center><h3>Search Result</h3></center>
- <table class='table'>
- <thead>
- <tr>
- <th>Name</th>
- <th>City</th>
- <th>Postal Code</th>
- </tr>
- </thead>
- <tbody>
- ";
- while($fetch = $query->fetch_array()){
- $output .= "
- <tr>
- <td>".$fetch['firstname']." ".$fetch['lastname']."</td>
- <td>".$fetch['city']."</td>
- <td>".$fetch['postal_code']."</td>
- </tr>
- ";
- }
- $output .="
- </tbody>
- </table>
- ";
- echo $output;
- }else{
- echo "<center><h4>Search Not Found!</h4></center>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment