Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. $username = "root";
  4. $password = "";
  5. $dbname = "1_wybory";
  6. header('Content-Type: text/html; charset=utf-8');
  7.  
  8. $conn = mysqli_connect("localhost", $username, $password, $dbname);
  9.  
  10. if (!$conn) {
  11. die("Connection failed: " . mysqli_connect_error());
  12.  
  13. }
  14.  
  15. mysqli_query($conn,"SET NAMES utf8");
  16. mysqli_query($conn,"SET CHARACTER_SET utf8_unicode_ci");
  17.  
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22.  
  23. $nationalid = $_POST['nationalid'];
  24. $sql = "SELECT id,surname,nationalid FROM electorate WHERE nationalid = $nationalid ";
  25.  
  26. $result = $conn->query($sql);
  27.  
  28. //header('Location: pass_gen_view.php');
  29.  
  30. if ($result->num_rows > 0) {
  31. while($row = $result->fetch_assoc()) {
  32. echo $row["id"];
  33. echo $row["surname"];
  34. echo $row["nationalid"];
  35. }
  36. }
  37.  
  38.  
  39. $conn->close();
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement