Category : PHP


How to get last 2 days records from table using Mysql Query?

We may sometimes require to get few days ago records from table like last 2 days, last 3 days, last 10 days or last 15 days etc. Most of developer choose other logic but we can easily get using mysql query(using CURDATE and INTERVAL). In this example mysql query i have one table "elements" and columns are id, title, description, created_at(timestamps) and update_at, Now we will get all records of last 2 days.so you can fetch fields value using CURDATE and INTERVAL of mysql. In following example you can see how to select data of last two days. <strong>Query:</strong> <pre> SELECT * FROM `elem.....

By Hardik Savani | July 22, 2016 | | 959 Viewer | Category : PHP
READ MORE

Bootstrap form validation example with demo using validator.js plugin

We always need to add validation on form like registration form, contact form, login form etc. we always prefer to give validation error after page refresh but you can give validation without page refresh. If you use bootstrap then you can use easily validator.js plugin. validator.js plugin gives client side validation without page refresh. We can use simply. validator.js plugin we can add validation in our PHP project, or any framework like laravel framework, codeigniter framework, symphony framework etc. In this example i give you how can you give validation for require field, email, minle.....

By Hardik Savani | July 20, 2016 | | 22582 Viewer | Category : PHP
READ MORE

How to remove duplicate values from Array in PHP?

It is pretty simple to delete duplicate values from PHP Array. But sometimes we confuse for how can we remove. But PHP provide pre-define function array_unique that can help to remove duplicate values from Array. array_unique() through we can get only unique value from array. So, you can see bellow example i have 34 value two times but when i use array_unique() then it will return only unique value as bellow output: <strong>Example:</strong> <pre class="prettyprint lang-php"> $myArray = [11,34,56,78,34]; $myArrayNew = array_unique($myArray); print_r($myArrayNew); </pre> <strong>Output:</str.....

By Hardik Savani | July 14, 2016 | | 560 Viewer | Category : PHP
READ MORE

How to get folder path from file path in PHP?

Sometimes, we require to get directory path from Image path or file url in our PHP website or any PHP framework website at that time we can get folder name using php pre-define function dirname. If you ever use this function then you can see as bellow example how it's works. I have one image url like, i want to just get folder path then you can get folder path like this way : <strong>Example:</strong> <pre class="prettyprint lang-php"> dirname('http://localhost:8000/upload/images/test.jpg'); </pre>

By Hardik Savani | July 4, 2016 | | 491 Viewer | Category : PHP
READ MORE

How to add CKEditor with image upload using KCFinder in PHP Example Code?

We can implement ckeditor with image uploading in PHP simply. if you want to use ckeditor in your PHP project and you also want to add file uploading as well then you can do easily to follow bellow step. In this example i use ckeditor with KCFinder for image uploading. KCFinder through we can file upload easily using their api. If you don't know about ckeditor and KCFinder then no issue you can add simple way. Now, i will give you few step to set ckeditor with file uploading and you will easily apply this. this is a very simple to browse your image, file etc upload. <strong>Preview:</stron.....

By Hardik Savani | June 30, 2016 | | 3531 Viewer | Category : PHP
READ MORE

How to solve - you dont have permission to upload files in KCFinder ?

I was working on my project and implementing KCEditor and CKFinder (the free one) with image upload, but when i tried to upload image i found error like "you don't have permissions to upload files". So, i though maybe issue for folder permission because i used ubuntu OS. i gave whole ckfinder folder give full permission 777 and also give ckeditor folder too. but same error. At last i found how to solve it. So if you have also fetch this error then you have to open config.php file in conf folder of ckfinder and disabled equal to give false. <strong>ckfinder/conf/config.php</strong> <pre clas.....

By Hardik Savani | June 30, 2016 | | 1510 Viewer | Category : PHP
READ MORE

How to get filename from path in PHP?

Sometimes, we may require to get only filename or image name from full path or url in your PHP project or any framwwork project at that time you can get file name using php pre-define function basename. If you ever use this function then you can see as bellow example how it's works. I have one image url like, i want to just get image name then you can get image name like this way : <strong>Example:</strong> <pre class="prettyprint lang-php"> basename("http://itsolutionstuff.com/upload/Laravel-5-Mailgun.png"); </pre>

By Hardik Savani | June 30, 2016 | | 521 Viewer | Category : PHP
READ MORE

Paypal payment gateway integration in php source code example

In this post i am going to give you example of how to integrate payment Paypal gateway in php with demo. It is very simple to use paypal payment method in your native php website because you don't need to use any api for paypal payment gateway integration. Paypal provide very simple way to do this and paypal also provide developer console i mean Sandbox account that way you can check it better. In this example i give you step by step payment integration of paypal. <strong>Preview:</strong> <img src="/upload/PHP-Paypal.png" width="100%" style="border:1px solid red"> <strong>Step 1: Create Sen.....

By Hardik Savani | May 31, 2016 | | 11276 Viewer | Category : PHP
READ MORE

How to get filename without extension in PHP?

If you need to get just filename from url withour file extension then you can get that using basename() php function. In bellow example i give you how to get image name without extension. first we need to get extension of given filename url and then basename() through we can remove that extension like as i did bellow: <strong>Example:</strong> <pre class="prettyprint lang-php"> $imagePath = "/home/hd/html/test.jpg"; $ext = pathinfo($imagePath, PATHINFO_EXTENSION); <br/> $file = basename($imagePath,".".$ext); print_r($file); </pre>

By Hardik Savani | May 26, 2016 | | 668 Viewer | Category : PHP
READ MORE

How to remove white space from string in PHP?

Sometimes we require to remove white space from given string. So at that time you can delete spaces from string using str_replace() of core php. str_replace() will help to replace whitespace that way we can remove. you can do it from bellow example. <strong>Example:</strong> <pre class="prettyprint lang-php"> $myString = "this is only for you"; $resultString = str_replace(' ', '', $myString); print_r($resultString); </pre>

By Hardik Savani | May 20, 2016 | | 877 Viewer | Category : PHP
READ MORE

    How to make simple dependent dropdown using jquery ajax in Laravel 5?

    How to make simple dependent dropdown using jquery ajax in Laravel 5?

    Open Post

    Laravel 5 Instagram API tutorial with example

    Laravel 5 Instagram API tutorial with example

    Open Post

    Laravel 5 - category treeview hierarchical structure example with demo

    Laravel 5 - category treeview hierarchical structure example with demo

    Open Post

    Simple Highcharts Chart Example using PHP MySQL Database

    Simple Highcharts Chart Example using PHP MySQL Database

    Open Post

    Laravel 5 - generate PDF from html view file and download using dompdf

    Laravel 5 - generate PDF from html view file and download using dompdf

    Open Post

    Laravel 5.3 new feature and update - $loop variable

    Laravel 5.3 new feature and update - $loop variable

    Open Post