Tagged: mysql

PHP AJAX Live Search Box Autocomplete Using MySQL Database 0

PHP AJAX Live Search Box Autocomplete Using MySQL Database

Today, We want to share with you PHP AJAX Live Search Box Autocomplete Using MySQL Database.In this post we will show you PHP Jquery AJAX Live Search Box Using MySQL, hear for PHP MySQL Live Search Box using Jquery Ajax Example we will give you demo and example for implement.In this post, we will learn about Jquery Ajax Live Search Box using PHP MySql with an example.

PHP AJAX Live Search Box Autocomplete Using MySQL Database

There are the Following The simple About PHP AJAX Live Search Box Autocomplete Using MySQL Database Full Information With Example and source code.

As I will cover this Post with live Working example to develop ajax live data search using jquery php mysql, so the some major files and Directory structures for this example is following below.

  • index.php
  • fetch.php

Step 1: Creating the Database Table

— Database: `member_list` >> — Table structure for table `member_tbl`

CREATE TABLE IF NOT EXISTS `member_tbl` (
  `MemberID` int(11) NOT NULL AUTO_INCREMENT,
  `MemberName` varchar(250) NOT NULL,
  `member_addr` text NOT NULL,
  `member_city` varchar(250) NOT NULL,
  `member_pcode` varchar(30) NOT NULL,
  `member_country` varchar(100) NOT NULL,
  PRIMARY KEY (`MemberID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;

Step 2: Dumping data On Table

Dumping data for table `member_tbl`

//ajax live data search using jquery php mysql
INSERT INTO `member_tbl` (`MemberID`, `MemberName`, `member_addr`, `member_city`, `member_pcode`, `member_country`) VALUES
(1, 'Jaydeep Gondaliya', 'sejal Str. 57', 'Berlin', '12209', 'Germany'),
(2, 'Ankit Kathiriya', 'Avda. de la Ram park 2222', 'USA D.F.', '5021', 'USA'),
(3, 'Krunal Sisodiya', 'sardha 2312', 'USA D.F.', '5475', 'USA'),
(4, 'chirag dethariya', '120 dsp salon Sq.', 'London', 'WA1 1DP', 'UK'),
(5, 'Dhaval dave', 'Rua do Ganesh, 12', 'Resende', '56458-363', 'UEA'),
(6, 'Pooja solanki', 'ul. astha 68', 'Walla', '01-658', 'Poland'),
(7, 'Bhakti Banugariya', 'kavya 45', 'Helsinki', '2853', 'India'),
(8, 'Nilesh chandvadiya', '305 - 14th Ave. S. Suite 3B', 'Seattle', '98128', 'USA'),
(9, 'Hitesh Ajani', 'Rua do Ganesh, 12', 'Resende', '098952-363', 'UEA'),
(10, 'Mayur Dhameliya', 'bhakti 38', 'Oulu', '321452', 'India'),
(11, 'Stavan Patel', '2, rue du chandni', 'Reims', '350024', 'France'),
(12, 'Parag shukla', '722 Titupati Blvd.', 'Kirkland', '360002', 'USA'),
(13, 'Vijay bhanderi', 'Bhavanath. 48', 'Butte', '225010', 'USA');

Step 3: Creating the Search Form

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

 
  
  <title>PHP AJAX Live Search Box Autocomplete Using MySQL Database</title>
  
  
  
 
 
  <div class="pakainfo container">
   <br />
   <h2 align="center">PHP AJAX Live Search Box Autocomplete Using MySQL Database</h2>
   
   <b>Simple ajax live data search using jquery php mysql</b><br />
   <div class="pakainfo form-group">
    <div class="input-group pakainfo">
     <span class="input-group-addon pakainfo">Search</span>
     
    </div>
   </div>
   <br />
   <div id="result"></div>
  </div>
 


$(document).ready(function(){

 ajax_data_load();

 function ajax_data_load(query)
 {
  $.ajax({
   url:"fetch.php",
   method:"POST",
   data:{query:query},
   success:function(data)
   {
    $('#result').html(data);
   }
  });
 }
 $('#query_search').keyup(function(){
  var search = $(this).val();
  if(search != '')
  {
   ajax_data_load(search);
  }
  else
  {
   ajax_data_load();
  }
 });
});

Step 4 : Processing Search Query in Backend

fetch.php for PHP AJAX Live Search Box Autocomplete server side source code

 0)
{
 $output .= '
  <div class="pakainfo table-responsive">
   <table class="table table bordered">
    <tr>
     <th>Member Name</th>
     <th>member Address</th>
     <th>member_city</th>
     <th>Member Post Code</th>
     <th>member_country</th>
    </tr>
 ';
 while($memres = mysqli_fetch_array($result))
 {
  $output .= '
   <tr>
    <td>'.$memres["MemberName"].'</td>
    <td>'.$memres["member_addr"].'</td>
    <td>'.$memres["member_city"].'</td>
    <td>'.$memres["member_pcode"].'</td>
    <td>'.$memres["member_country"].'</td>
   </tr>
  ';
 }
 echo $output;
}
else
{
 echo 'Data Not Found';
}

?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP AJAX Live Search Box Autocomplete Using MySQL Database.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Fetch Last week month year records in MySQL 0

Fetch Last week month year records in MySQL

Today, We want to share with you Fetch Last week month year records in MySQL.In this post we will show you How to fetch this week records in MySql ?, hear for SELECT IN MYSQL CURRENT DAY, CURRENT WEEK, LAST WEEK we will give you demo and example for implement.In this post, we will learn about Last one week, month, year record from date field by DATE_SUB with an example.

Fetch Last week month year records in MySQL

There are the Following The simple About Fetch Last week month year records in MySQL Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Get Last 7 days month year record from MySQL, so the get this week records mysql,fetch current week records mysql for this example is following below.

If We require to get all the MySQL Database records of current week using mysql query. for example We have one SQL table “products” as well as all the columns are product_id, product_title, product_description, created_at as well as update_at timestemp, And then We need to fetch all records of this week. therefor We can fetch all the fields value using DATE_SUB and INTERVAL of simple mysql Table. In following simple example We can display how to MySQL select data of fetch current week.

SELECT * FROM products WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 WEEK);

Last 10 days records

select * from products where  `date` >= DATE_SUB(CURDATE(), INTERVAL 10 DAY)

DATE_SUB() Fetch the recent one month or year records from PHP MySQL table

SELECT DATE_SUB(  '2019-12-25', INTERVAL 3 DAY )

Present Month Records

SELECT * FROM `products` WHERE  date between  DATE_FORMAT(CURDATE() ,'%Y-%m-01') AND CURDATE()

Present Year Records

SELECT * FROM `products` WHERE  date between  DATE_FORMAT(CURDATE() ,'%Y-01-01') AND CURDATE()

Last one month records

select * from products where  `date` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)

Records of two date ranges

select * from products where `date` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 3 MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 0 MONTH )

Fetch records between 6 month and 12 month

select * from products where `date` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 12  MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 6 MONTH )

MYSQL CURRENT DAY

SELECT IN MYSQL CURRENT DAY, CURRENT WEEK, LAST WEEK

Selecting MySQL records for the current day:

SELECT *
FROM (`products`)
WHERE date = CURDATE()  

MYSQL CURRENT week

SELECT IN MYSQL CURRENT DAY, CURRENT WEEK, LAST WEEK

Selecting MySQL records for the current week:

SELECT SUM(o_price) price
FROM (`orders`)
WHERE YEARWEEK(`o_date`) = YEARWEEK(CURDATE()) 

MYSQL CURRENT week

SELECT IN MYSQL CURRENT DAY, CURRENT WEEK, LAST WEEK

Selecting MySQL records for the current week:

SELECT *
FROM (
`products`
)
WHERE YEARWEEK( `date` ) = YEARWEEK( CURDATE( ) + INTERVAL 1 WEEK )
LIMIT 0 , 30

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Fetch Last week month year records in MySQL.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel Eloquent query where exists MySQL 0

Laravel Eloquent query where exists

Today, We want to share with you Laravel Eloquent query where exists.In this post we will show you Laravel 5 query builder where exists example, hear for Check If A Database Table Exists With Laravel we will give you demo and example for implement.In this post, we will learn about Laravel Advance Database Query Builder with an example.

Laravel Eloquent query where exists

There are the Following The simple About Laravel Eloquent query where exists Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP SQL exists in Laravel 5 query builder, so the Laravel Eloquent – WhereNotExists for this example is following below.

We use simple Code PHP sql where exists clause in check laravel. whereExists through We can use Database in sql where exists clause in Latest version of the laravel Web project. It is simple and very easy to use as well as We can best way to implements and undestand. We can give simple fire SELECT statment in where some condition. We can see bellow source code with example as well as We can learn how to use simple whereExists in your Laravel app.

Simple SQL Query

SELECT *
FROM `products`
WHERE EXISTS
    (SELECT `products_cat`.`id`
     FROM `products_cat`
     WHERE products_cat.cat_id = products.id)

MySQL Using Laravel Query Builder

DB::table('products')
    ->whereExists(function ($query) {
        $query->select("products_cat.id")
              ->from('products_cat')
              ->whereRaw('products_cat.cat_id = products.id');
    })
    ->get();

Example 2: SQL exists in Laravel 5 query builder

$product = Products::whereNotExists(function ($query) use ($id_merchant) {
	$query->select(DB::raw(1))
		  ->from('merchant_poeni')
		  ->where('product.id', '=', 'a.id')
		  ->where('product_id', '=', $id_merchant);
})
->orderBy('created_at')
->first();

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Eloquent query where exists.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

localhost Phpmyadmin Server Error Solution 0

localhost Phpmyadmin Server Error

Today, We want to share with you localhost Phpmyadmin Server Error.In this post we will show you Solution : XAMPP phpmyadmin MySQL said cannot connect: invalid settings, hear for Error Resolved : Connection for controluser as defined in your configuration failed. we will give you demo and example for implement.In this post, we will learn about #2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured) with an example.

localhost Phpmyadmin Server Error

There are the Following The simple About localhost Phpmyadmin Server Error Full Information With Example and source code.

As I will cover this Post with live Working example to develop Resolve : phpMyAdmin — Error, so the some best error solution XAMPP phpmyadmin MySQL said cannot connect: invalid settings for this example is following below.

Local Server Error

MySQL said: Documentation

#2002 – No such file or directory — The server is not responding (or the local server’s socket is not correctly configured).

mysqli_real_connect(): (HY000/2002): No such file or directory
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/2002): No such file or directory

localhost Phpmyadmin Server Error

localhost Phpmyadmin Server Error

It turns out that the solution is to simple Laravel stop all the related Local Server Error services and solve the “Another daemon is already running” issue.

Way 1: Local Server Error Solution

The lampp var commands We used to resolve (#2002 – No such file or directory — The server is not responding (or the local server’s socket is not correctly configured).) the issue are as follows step by step run:

sudo /opt/lampp/lampp stop              
sudo /etc/init.d/apache2 stop    
sudo /etc/init.d/mysql stop

Way 2: Or, We can also some type commands instead:

sudo service apache2 stop
sudo service mysql stop

And then, we again simple ubuntu start the lampp services:

sudo /opt/lampp/lampp start

Final Testing

And then, there must be no any some problems while opening:

http://localhost   or your IP (http://http://192.168.0.41/your_project_name)               
http://localhost/phpmyadmin  or your IP (http://http://192.168.0.41/phpmyadmin)

Ref : Phpmyadmin denied access – localhost
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about localhost Phpmyadmin Server Error.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

MySQL Remove special characters from database 0

MySQL Remove special characters from database

Today, We want to share with you MySQL Remove special characters from database.In this post we will show you MySQL Function to remove accents and special characters, hear for How to remove special characters by mysql custom function we will give you demo and example for implement.In this post, we will learn about remove special characters from phone number mysql with an example.

MySQL Remove special characters from database

There are the Following The simple About MySQL Remove special characters from database Full Information With Example and source code.

As I will cover this Post with live Working example to develop Remove special characters from a database field, so the mysql select column with special characters for this example is following below.

MySQL Create removeSpacialChar function:

CREATE FUNCTION `removeSpacialChar`(`request_data` varchar(4096)) RETURNS varchar(4096) CHARSET utf8 
BEGIN
      DECLARE result_data VARCHAR(4096) DEFAULT ''; 
      DECLARE c VARCHAR(4096) DEFAULT ''; 
      DECLARE myctr INT DEFAULT 1; 
 
      IF ISNULL(request_data) THEN
            RETURN NULL; 
      ELSE
            WHILE myctr <= LENGTH(request_data) DO 
 
                  SET c = MID(request_data, myctr, 1); 
 
                  IF (ASCII(c) >= 48 AND ASCII(c) <= 57) OR (ASCII(c) >= 65 AND ASCII(c) <= 90) OR (ASCII(c) >= 97 AND ASCII(c) <= 122) THEN
                      SET result_data = CONCAT(result_data, c); 
                  ELSE
                      SET result_data = CONCAT(result_data, ' ');   
                  END IF; 
 
                  SET myctr = myctr + 1; 
            END WHILE; 
      END IF; 
 
      RETURN result_data; 
END

Use With Select Query:

SELECT removeSpacialChar(products.name) FROM `products`

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about MySQL Remove special characters from database.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel GroupBy Error Solution 5.5 , 5.6, 5.7 0

Laravel GroupBy Error Solution 5.5 , 5.6, 5.7

Today, We want to share with you Laravel GroupBy Error Solution 5.5 , 5.6, 5.7.In this post we will show you GroupBy Not Working In Laravel Fix, hear for laravel only_full_group_by we will give you demo and example for implement.In this post, we will learn about laravel select list is not in group by clause and contains nonaggregated column with an example.

Laravel GroupBy Error Solution 5.5 , 5.6, 5.7

There are the Following The simple About Laravel GroupBy Error Solution 5.5 , 5.6, 5.7 Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel only_full_group_by, so the some major files and Directory structures for this example is following below.

  • laravel groupby tutorial

Laravel 5.5 , 5.6, 5.7 group by fixed

Error : SQLSTATE[42000]: Syntax error or access violation: 1055

Syntax error or access violation: 1055 isn’t in GROUP BY in Laravel

Step 1 : Open Your config/database.php file

config/database.php

simply Laravel Project“strict” mode make it boolean value true into false in (config/database.php)database.php file

//Database setting
...
'strict' => true,
To
'strict' => false,
....

Laravel : Syntax error or access violation: 1055 Error

Laravel group by Example – fixed

groupBy Query

$members = DB::table("members")
            ->groupBy("name")
            ->get();
dd($members);

How To Fix GroupBy Not Working In Laravel 5.5 , 5.6, 5.7

CallLogModel::selectRaw('count(*) AS cnt, caller')->groupBy('caller')->orderBy('cnt', 'DESC')->limit(5)->get();

laravel select list is not in group by clause and contains nonaggregated column

Laravel Group By Count Multiple Columns
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel GroupBy Error Solution 5.5 , 5.6, 5.7.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel Increase Website Speed performance optimization 0

Laravel Increase Website Speed performance optimization techniques

Today, We want to share with you Laravel Increase Website Speed performance optimization techniques.In this post we will show you How to Increase Website Speed in Laravel, hear for Laravel Increase Website Speed Optimization Performance Tips we will give you demo and example for implement.In this post, we will learn about Laravel Increase Website Speed performance optimization techniques with an example.

Laravel Increase Website Speed performance optimization techniques

There are the Following The simple About Laravel Increase Website Speed performance optimization techniques Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to Optimize Website Speed and Performance in Laravel, so the some major files and Directory structures for this example is following below.

  • setup Laravel Application
  • Make Laravel a View File
  • Make a Laravel Route
  • Install laravel-page-speed Package
  • Change Settings
  • Laravel 5.4 or 5.3
  • Laravel 5.5 or 5.6 or 5.7
  • Laravel Application Testing

Step #1: Simple Step By step Setup Laravel Application

Setup Simple Laravel 5.6 Project

$ composer create-project --prefer-dist laravel/laravel optimizewebsitespeed

Step #2: Make a Laravel View File

resources/views/welcome.blade.php

<!-- welcome.blade.php -->
<!DOCTYPE html>
<html>
<head>
    <title>Laravel Increase Website Speed performance optimization techniques</title>
    <link rel="stylesheet" href="{{asset('css/app.css')}}">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <h1>Laravel Increase Website Speed performance optimization techniques</h1>
    <table class="pakainfo table table-bordered">
        <thead>
          <tr>
            <th>Id</th>
            <th>Devloper Name</th>
            <th>Devloper Email</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>1</td>
            <td>Jaydeep</td>
            <td>[email protected]</td>
          </tr>
          <tr>
            <td>2</td>
            <td>Krunal</td>
            <td>[email protected]</td>
          </tr>
          <tr>
            <td>3</td>
            <td>Ankit</td>
            <td>[email protected]</td>
          </tr>
          <tr>
            <td>4</td>
            <td>chirag</td>
            <td>[email protected]</td>
          </tr>
          <tr>
            <td>5</td>
            <td>dhaval</td>
            <td>[email protected]</td>
          </tr>
        </tbody>
    </table>
</div>
</body>
</html>

Step #3: Laravel Create Route

web.php

Route::get('data', function () {
    return view('data');
});

Step #4: Setup laravel-page-speed Package

renatomarinho/laravel-page-speed composer package

//Laravel Increase Website Speed performance optimization techniques
$ composer require renatomarinho/laravel-page-speed

Step #5: Settings change some Configuration

config/app.php (Laravel 5.4 or 5.3)

'providers' => [
              RenatoMarinho\LaravelPageSpeed\ServiceProvider::class
               ]

Laravel 5.5 / Laravel 5.6 / Laravel 5.7 Versions

laravel any 5.5+ follow below some steps

php artisan vendor:publish --provider="RenatoMarinho\LaravelPageSpeed\ServiceProvider"

app/Http/Kernal.php

protected $middleware = [
    ...
    \RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\InlineCss::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,
]

Step #6: Laravel Project Testing

Finnal step to Run your project and check Your Laravel Speeds.

php artisan serve

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Increase Website Speed performance optimization techniques.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.