• 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

MOODLE: What does it mean to aggregate h5p assets?

Generate random username based on full name php

PHP web3 ERC20 token function call

How do I upload a laravel project on cPanel shared hosting?

Elastic Beanstalk with Laravel Envoy

Check for PDO Results, If None Display Message, If Yes then Loop Through

Losing session data after POST from third party website

mysql_result is defined but mysql_free_result warns it expected a resource

PHPExcel export HTML table to xlsx

Laravel/docker-compose/redis - Class 'Redis' not found

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

SilverStripe unable to populate multiple member Childs

Submitting a form with ajax in Wordpress

Parameter is not sent to Laravel route in Ajax

How to execute sql code based on fetch array

About Contact Privacy policy Terms and conditions