Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. mysql_connect ("localhost","monkey","monkey") or die ("could not
  3. connect");
  4. mysql_select_db("dbtest") or die ("could not find db");
  5. $output = '';
  6. // collect
  7. if (isset($_POST['search'])) {
  8. $searchq = $_POST['search'];
  9.  
  10.  
  11. $query = mysql_query("SELECT * FROM accounts WHERE LNAME LIKE '%$searchq%'") or die("Could not search.");
  12. $count = mysql_num_rows($query);
  13. if($count == 0) {
  14. $output = 'No results found.';
  15. } else {
  16. echo"<table border ='1'>";
  17. echo"<tr><td>First Name</td><td>Last Name</td><td>Email</td><td>Phone</td>
  18. </tr>";
  19. while($row = mysql_fetch_array($query)) {
  20. echo"<tr><td>{$row['FNAME']}</td><td>{$row['LNAME']}</td><td>
  21. {$row['EMAIL']}</td><td>{$row['PHONE_NUMBER']}</td></tr>";
  22.  
  23.  
  24. }
  25. echo"</table>";
  26. }
  27. }
  28. ?>
  29.  
  30. echo "<tr><td>{$row['FNAME']}</td><td>{$row['LNAME']}</td><td><a href="mailto:{$row['EMAIL']}">{$row['EMAIL']}</a></td><td>{$row['PHONE_NUMBER']}</td></tr>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement