Guest User

Untitled

a guest
Jun 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2. $db = mysql_connect("localhost", "root", "");
  3. mysql_select_db("ajax_search");
  4. mysql_query("SET CHARACTER SET utf8");
  5.  
  6.  
  7. $sString = "doc";//mysql_real_escape_string($_GET["search"], $db);
  8.  
  9. $sql="SELECT * FROM `articles` WHERE `title` LIKE '%$sString%' OR `content` LIKE '%$sString%' ORDER BY `id` DESC LIMIT 10";
  10.  
  11. $rs=mysql_query($sql,$db);
  12.  
  13.  
  14.  
  15.  
  16. if (mysql_num_rows($rs) > 0)
  17. {
  18. while ($row = mysql_fetch_array($rs))
  19. {
  20. echo $row["title"];
  21. ?>
  22. </br>
  23. <?
  24.  
  25. }
  26.  
  27. }
  28.  
  29.  
  30. echo $sql;
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment