Advertisement
Guest User

Untitled

a guest
Dec 4th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. $db ='sanjeev'; $host ='localhost'; $user='root'; $pass='';
  3. $pdo = new PDO('mysql:dbname='.$db.'; host='.$host,$user,$pass);
  4.  
  5. if(isset($_POST['search'])){
  6. $key=$_POST['key'];
  7. $result = $pdo->query("SELECT * FROM tbl_person WHERE surname LIKE '%$key%'");
  8. echo "<ul>";
  9. foreach ($result as $row) {
  10. echo '<li>'.$row['firstname'].' '.$row['surname'].' was born in '.$row['birthdate'].' has email id '. $row['email']. '</li>';
  11. }
  12. echo '</ul>';
  13. }
  14. ?>
  15.  
  16. <form action="" method="POST">
  17. <input type="text" name="key"><br><br>
  18. <input type="submit" name="search" value="Search">
  19. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement