• 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

Dynamic dropdown Ajax PHP request

php retrieve specific data onclick from database in a list format

PHP: Insert marker every 3 iterations

Can we define variables in `.tpl` files?

echo language construct is discouraged. (PHP)

How to show selected value using javascript in laravel

Using array_intersect on a multi-dimensional array

500 (Internal Server Error) with Laravel & Docker [duplicate]

PHP header location absolute URL

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

How to read laravel_session cookies saved in cookie memory of browser in client side?

500 Internal Server Error on Ajax request. Not sure the origin of the problem

PHPS source file - 403 Forbidden You don't have permission to access this resource

Get WooCommerce product variation attribute terms in admin products general box

Shopify password update using Shopify API

About Contact Privacy policy Terms and conditions