Category: mysql

Left Join Query in Laravel 5

The leftJoin method has the same signature as the join method. When I fetch all columns from the get-go, the query takes too load to complete (around 5 secs on 350k rows), whereas with a left join that’s cut into only half a second. Let’s create a leftJoin method in laravel 5

How to create a unique random string in PHP with check MySQL

When building web software applications I sometimes need a way to generate unique random strings. Unique random strings can be used as character keys or tokens to identify database records without having to give away the database records ID number. I personally use unique random strings to produce clickable links in my “Request lost password” […]

How to Auth Logout in Laravel 5

In this tutorial, we are going to cover the authentication logout system in the Laravel 5 framework. Auth::logout() function to destroy all authentication information so find out below code. Steps For How to Auth Logout in Laravel 5 Step 1. Create route We are required only one route to call controller. Step 2. SigninController with […]

Create MySQL table by using another table

Create MySQL table based on one or more existing tables. Here we create a new table called TempCustomer for Customers. CREATE TABLE TempCustomer AS SELECT first_name, last_name FROM ExternalCustomer AS c  WHERE c.create_date >= ‘8/1/2015’; In the above query, a new table named TempCustomer is created from the external customer table. Only customers created after August 2015 […]

PHP array_multisort() Function

The array_multisort() function returns a sorted array. You can assign one or more arrays. The function sorts the first array, and the other arrays follow, then, if two or more values are the same, it sorts the next array, and so on. Note: Associative (string) keys will be maintained, but numeric keys will be re-indexed. […]