Guest User

Untitled

a guest
Jun 13th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?
  2. $MySQLPassword = "indian";
  3. $HostName = "localhost";
  4. $UserName = "monty";
  5.  
  6. mysql_connect($HostName,$UserName,$MySQLPassword)
  7. or die("ERROR: Could not connect to database!");
  8.  
  9. mysql_select_db("sachin") or die("cannot select db");
  10.  
  11. $keyword = $_POST['keyword'];
  12. echo $keyword;
  13. /* Execute the query that performs the actual search in the DB: */
  14. $result = mysql_query(" SELECT p.page_url AS url,
  15. COUNT(*) AS occurrences
  16. FROM page p, word w, occurrence o
  17. WHERE p.page_id = o.page_id AND
  18. w.word_id = o.word_id AND
  19. w.word_word = "$keyword"
  20. GROUP BY p.page_id
  21. ORDER BY occurrences DESC
  22. " );
  23.  
  24. $output = new DOMDocument();
  25. $output->formatOutput = true;
  26. $output = "<loginsuccess>";
  27.  
  28. for( $i = 1; $row = mysql_fetch_array($result); $i++ ) {
  29.  
  30.  
  31. $output .="<person><keyword>".$_POST['keyword']."</keyword><name>".$row['url']."</name><occur>".$row['occurrences']."</occur></person>";
  32. }
  33.  
  34. $output .= "</loginsuccess>";
  35. print ($output);
  36.  
  37. ?>
  38.  
  39. $handle = fopen($filename , "wb")
Add Comment
Please, Sign In to add comment