Guest User

Untitled

a guest
Dec 6th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public function e ($var){
  2. $escaped_info = mysqli_real_escape_string($this->mysqli, $var);
  3. return htmlspecialchars($escaped_info, ENT_QUOTES, 'UTF-8');
  4. }
  5.  
  6. public function selectionQueryLike($table, $id, $column)
  7. {
  8.  
  9. if(!empty($table) || !empty($id) || !empty($column))
  10. {
  11. $sql = "SELECT * FROM $table WHERE $column LIKE '%{$id}%'";
  12. return $this->mysqli->query($sql);
  13. }
  14.  
  15. $authentication = new DBRequest($host = 'localhost',
  16. $user = 'root',
  17. $pass = '',
  18. $db = 'contas');
  19.  
  20. $selectedstudents = $authentication->selectionQueryLike("alunos", $_POST['st_process'], "student_process");
  21.  
  22. if(mysqli_num_rows($selectedstudents) > 0){
  23. echo "<table><tr><th>Nome</th><th>NºProcesso</th><th>ID</th></tr>";
  24.  
  25. while($row = $selectedstudents->fetch_assoc()){
  26. echo "<tr>";
  27. echo "<td><a href='#'>" . $row["student_name"] . "</a></td>";
  28. echo "<td>" . $row["student_process"] . "</td>";
  29. echo "<td>" . $row["student_ID"] . "</td>";
  30. echo "</tr>";
  31. }
  32. echo "</table>";
  33.  
  34.  
  35. }
Add Comment
Please, Sign In to add comment