• 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

PHP each() function replacement

CONCAT columns with Laravel 5 eloquent

Cut an arabic string

Shopify password update using Shopify API

How to make a foreign key not using primary key

How to Display Data in Yajra Datatables Laravel 7?

Session timeout in Yii2

Batch request Google Calendar php API

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

Create a new line whenever an array value reaches more than 10 characters

Select option from dropdown menu with PHP and mySql

How to remove from a multidimensional array all duplicate elements including the original?

Apply session id from request header

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

get data-value with variable value

About Contact Privacy policy Terms and conditions