SHARE
TWEET

Untitled

a guest May 22nd, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $dbhost = "localhost";
  4. $dbuser = "root";
  5. $dbpass = "";
  6. $dbname = "isvykstu";
  7.  
  8. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
  9. mysql_select_db($dbname);
  10.  
  11. if(isset($_GET['query'])) { $query = $_GET['query']; } else { $query = ""; }
  12. if(isset($_GET['type'])) { $type = $_GET['type']; } else { $query = "count"; }
  13.  
  14. if($type == "count")
  15. {
  16.     $sql = mysql_query("SELECT count(ID) FROM registered_cvs WHERE MATCH(name,surname)AGAINST('$query' IN BOOLEAN MODE)");
  17.     $total = mysql_fetch_array($sql);
  18.     $num = $total[0];
  19.    
  20.     echo $num;
  21.    
  22. }
  23.  
  24. if($type == "results")
  25. {
  26.     $sql = mysql_query("SELECT name,surname FROM registered_cvs WHERE MATCH(name,surname) AGAINST('$query' IN BOOLEAN MODE)");
  27.     while($array = mysql_fetch_array($sql)) {
  28.  
  29.        
  30.        
  31.         echo "<div class=\"url-holder\"><a href=\"" . $array[name]. "\" class=\"url-surname\" target=\"_blank\">" . $array[surname] . "</a>
  32.    
  33.     <div class=\"url-desc\">DESCRIPTION</div></div>";
  34.                
  35.     }
  36.    
  37. }
  38.  
  39. mysql_close($conn);
  40.  
  41. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top