Guest User

Untitled

a guest
Mar 16th, 2018
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. <?php
  3. $servername = "localhost";
  4. $username = "username";
  5. $password = "password";
  6. $dbname = "myDB";
  7.  
  8. // Create connection
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10. // Check connection
  11. if ($conn->connect_error) {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14.  
  15. $sql = "SELECT lastname FROM TableName";
  16. $result = $conn->query($sql);
  17.  
  18. if ($result->num_rows > 0) {
  19. // output data of each row
  20. while($row = $result->fetch_assoc()) {
  21.  
  22. if(substr_count($row["lastname"],"iii")){
  23. echo $words[$i]. " ";
  24. }
  25.  
  26.  
  27. }
  28. } else {
  29. echo "0 results";
  30. }
Add Comment
Please, Sign In to add comment