• 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 do I loop through an MS SQL database with VB.NET?

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Natural ORDER in Laravel Eloquent ORM

How to create a video stream from a single dynamic image in PHP

php 7 php.ini upload_max_filesize not working

Server-sent events in PHP (without echo or print)

Symfony there are no commands defined in the "make" namespace

Target class controller does not exist - Laravel 8

PHP using str_starts_with for array to exclude same as with wildcard

Wordpress how to get the post thumbnail inside a figure tag

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

HTML + PHP + PHPMAILER

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

PHP file_get_contents function

PHP DOTENV unable to load env vars

About Contact Privacy policy Terms and conditions