• 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

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Backend cannot be reached after Typo3 login screen

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

How to get page number on dompdf PDF when using "view"

Match csv filenames to table names and import

Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'

Laravel get user data with profile

Laravel dosen't connect with Oracle

Get data from accuweather api url

Cant seem to get the Pagination to work on my WooCommerce REST API application?

could not find driver Debian SQL Server PHP

What is my SQL missing?

Wordpress wpdb->delete issue

WHERE IN array binding in DB::raw laravel 5.4

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

About Contact Privacy policy Terms and conditions