Category : MySql


How to get last executed mysql query in laravel ?

If you are working on laravel framwork and you use query builder of laravel 5. but you want to get last executed mysql query from laravel. If you are working on laravel 5 then you have to first enable query log that way it can be store query log. At last getQueryLog() through you can get last executed query. I give you example of how to get last executed mysql query. you can use example as following example. <pre class="language-php"> public function querylog() { DB::enableQueryLog(); $item = Item::find(2); $last_query = DB::getQueryLog(); print_r($last_query); } </pre> Try this......

By Hardik Savani | January 11, 2016 | | 1036 Viewer | Category : MySql
READ MORE

Mysql procedure with pagination in laravel 5?

You are working on laravel with mysql database. you had created mysql procedure for get data and you want to call procedure with pagination in laravel 5 then you can not directly make pagination as laravel document.If you are using directly MySQL stored Procedure in your controller, model or repository and you want to give pagination like this way : <pre class="language-php"> $data = DB::select(DB::raw('CALL hardik("hari")'))->paginate(5); </pre> This way you found error in your Laravel 5 website. we can't give directly this way pagination because your procedure will get all the data fr.....

By Hardik Savani | January 11, 2016 | | 1821 Viewer | Category : MySql
READ MORE

Which MySQL datatype use for store an IP address?

If you want to store IP address in mysql database then don’t mistake to use varchar datatype because you can use INT UNSIGNED 4(BYTE) datatype. using integer datatype you can save more space in database. when you fire insert query at that time use INET_ATON() and select query at that time INET_NTOA() use. how to use this function given bellow example. <strong>Create Table : </strong> <pre class="language-mysql"> CREATE TABLE IF NOT EXISTS `ip_addresses` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ip_address` INT(4) UNSIGNED NOT NULL, PRIMARY KEY (`id`) ); </pre> <strong>Insert Da.....

By Hardik Savani | January 7, 2016 | | 703 Viewer | Category : MySql
READ MORE

Mysql Hexadecimal color code store in binary datatype.

If you have thousands of record store, that time database size would be large. but you can some field can save your number of bites in the database. you have color field then most of you choose string(6) data type and you wast 6 bites on every record, but you can save number of bites data by using BINARY(3) data type. following example through you can set data type for hexa color code with only allocate binary(3) on every records. first how to create table and assign data type with following query. <pre class="language-mysql"> CREATE TABLE IF NOT EXISTS `colors` ( `id` int(10) unsigned NOT N.....

By Hardik Savani | January 7, 2016 | | 961 Viewer | Category : MySql
READ MORE

    CRUD (Create Read Update Delete) Example in Laravel 5.2 from Scratch

    CRUD (Create Read Update Delete) Example in Laravel 5.2 from Scratch

    Open Post

    Laravel 5.3 - Customize pagination templates example from scratch

    Laravel 5.3 - Customize pagination templates example from scratch

    Open Post

    Laravel 5 - Google reCaptcha code and Validation example using anhskohbo/no-captcha package

    Laravel 5 - Google reCaptcha code and Validation example using anhskohbo/no-captcha package

    Open Post

    Jquery - Display a loading gif image before a image loads using Eager ImageLoader plugin

    Jquery - Display a loading gif image before a image loads using Eager ImageLoader plugin

    Open Post

    Laravel 5 - category treeview hierarchical structure example with demo

    Laravel 5 - category treeview hierarchical structure example with demo

    Open Post

    Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.

    Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.

    Open Post