Guest User

Untitled

a guest
Mar 12th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. $u = new UsersDAO("host=localhost port=5432 dbname=mydatabase user=naruse password=narusegawa");
  3.  
  4. $tabla=$u->getAll("users");
  5.  
  6. $i = 0;
  7. while ($line = pg_fetch_assoc($tabla)){
  8.  
  9. $name = $line["name"];
  10. $age = $line["age"];
  11.  
  12. if ($name == $_REQUEST["nombre"] && $age == $_REQUEST["age"] {
  13. $found = true;
  14. print_user($linea);
  15. break;
  16. }
  17. }
  18.  
  19. if !($found)
  20. print "Algo, no lo encontre, blablablbla";
  21.  
  22.  
  23. pg_free_result($tabla);
  24.  
  25. function print_user($user) {
  26. echo "<table>\n";
  27. echo "\t<tr>\n";
  28. foreach ($user as $field_val)
  29. echo "\t\t<td>$field_val</td>\n";
  30. echo "\t</tr>\n";
  31. echo "</table>"
  32. }
  33. ?>
Add Comment
Please, Sign In to add comment