Advertisement
Guest User

Untitled

a guest
May 12th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. $matchcount = preg_match_all('/<div class="name">(.*?)</div>/s', $data,$matches);
  2.  
  3. $hostname = "localhost";
  4. $username = "root";
  5. $password = "baekhyun8100";
  6. $databaseName = "student_information";
  7. $connect = mysqli_connect($hostname, $username, $password, $databaseName);
  8. $query = "INSERT INTO student_information";
  9. $result = mysqli_query($connect, $query);
  10.  
  11. if ($matchcount > 0) {
  12.  
  13. for($i = 0; $i < $matchcount; $i++) {
  14. echo("n" . "n");
  15. #echo($matches[1][$i]);
  16. echo strip_tags($matches[1][$i], '<div>');
  17.  
  18. mysqli_query($connect, "INSERT INTO `student_information` (`name`) VALUES
  19. ('" . strip_tags($matches[1][$i]) . "');");
  20. }
  21.  
  22. } else {
  23. echo('No matches');
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement