• 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

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Show only featured products in Woocommerce shop page

Symfony Error: "An exception has been thrown during the rendering of a template"

In PHP, which is faster: preg_split or explode?

Alert message after submitting form in PHP

Get WooCommerce product variation attribute terms in admin products general box

Laravel unique validation on multiple columns

PHP if in_array() how to get the key as well?

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

PHP Imap , php 7.4.3 on mac osx catalina

How to check user Permissions using Custom Middleware in Laravel

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Add restriction to WooCommerce coupons by allowed user ID

Assign output of PHP function to a variable

About Contact Privacy policy Terms and conditions