• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Live search query using JS and PHP for QA forum

phpmysql


PHP Snippet 1:

foreach ($words as $keywords) { 
  echo $keywords.'<br>';
  $keyword = trim($keywords);
  if(strlen($keyword)>0){
    $sql="SELECT * FROM qa_posts WHERE title like '%".$keywords."%' OR content like '%".$keywords."%' OR tags like
    '%".$keywords."%' limit 10 "; 

  $q=mysqli_query($dbc,$sql);
  while($res=mysqli_fetch_array($q)){
   echo "<a href='".$res['slug']."'>".$res['title']."</a><br>";
  } 
 }
}

Related Snippets

how to insert data into select2 search input after scan using qrcode

Laravel Factory not calling callback 'afterCreating'

PHP array sort and remove duplicates by two field values

Printing more than one array using print_r or any other function in php

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

How to get the ID of the link in another page in php

Select option menu read from database and use it's values

phpunit - testing is painfully slow

How can I access an array/object?

Two buttons one form

Trying to iterate over a mongodb cursor twice - failing

CSS file not imported in laravel blade view

XDebug not working in VScode for php debugging

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

About Contact Privacy policy Terms and conditions