In this tutorial we are going to learn connecting to MySQL with PHP using PDO. “PDO – PHP Data Objects – is a database access layer providing a uniform method of access to multiple databases.” You don’t need to worry about different syntax for different database types, PDO will do this painless. # connect to…Continue Reading
PHP
How to get Query Strings Value from a URL in Laravel 5.5?
When you work with Laravel it is very common to get query string values from URL. In native PHP you can get this via $_GET variable. But when you want to get Query strings from a URL in Laravel you can use the below methods. Either you can use Request Facade or Input facade in…Continue Reading
PHP GET and POST Method
When we are using html form, we can send data to another page using two different methods POST method GET method Both serves same purpose, but the internal mechanism is bit different. When using GET method key value pairs are passing through browser navigation bar. But for POST method a visitor cannot see the data…Continue Reading
How to capture screenshot of website from URL in PHP
You may have a requirement to show the website’ screenshot in certain pages. You can use some third-party paid services for that. But here we are demonstrating a free service, that too from Google. You can write your own script to get the screenshot from URL. Basically, Google PageSpeed Insights API is used to analyze…Continue Reading
CodeIgniter – Basic Concepts
Codeigniter is a small footprint MVC framework that helps programmers to create robust web applications. It is considered as one of the smallest frameworks when coming to the size and learning curve. What are the basic concepts in codeigniter ? Controllers Controllers are the entry point in any web application. So controller does same duty…Continue Reading
Ways To Redirect URLs to Another web page
Different ways to redirect one page to another, this tutorial describes that. You can use different programming/scripting languages to achieve this. We can use server side programming language or client side scripting language like HTML, Javascript. Redirect using PHPRedirect using HTML meta tag Redirect using Javascript timeout function
PHP User Registration Form
This tutorial teaches about building a PHP User Registration Form. When user registering we collect their information such as username, email etc and storing in a database. The application uses this data for user authentication or user reporting etc. In this tutorial user adding their details in the registration form and a validation, script validates all…Continue Reading
Better Way To Prevent Image Hotlinking with .htaccess
What is image hotlinking and how to prevent it? Image hotlinking – It is someone directly taking the image URL from your server and embedding it on their website. It’s kind of image stealing, but most importantly losing your bandwidth. Usually, you have to pay for the server bandwidth. When someone hotlinking the image in…Continue Reading
How to do batch insert in codeigniter
Follow below to do batch insert in Codeigniter framework. As a Codeigniter developer you many encounter this situation to insert heavy amount of data using batch insert.
PHP Redirect 301 permanently
You may want redirect one website to another for some reason. This article show you how to redirect a website to another using php scrips. When you do it should be more search engine friendly at any cost. PHP Redirect Code header(“HTTP/1.1 301 Moved Permanently”); header(“Location: https://www.tutsplanet.com”); exit; Basically you can avoid the first line,…Continue Reading
PHP date() with timezone?
How to get PHP date() with timezone?. PHP date() function returns a string formatted according to the given format string using the given integer timestamp or the current time if there are no timestamp is given. For example, you want print today’s date in Mon 27, Feb 2017. It’s very easy just follow the below…Continue Reading
Server Side Form Validation using Regular Expressions
In server side scripting its mandatory to do the form validation. It’s not another case for PHP. Here I demonstrate the simple PHP form validation using the regular expression.
How to Get Yesterday’s Date Using PHP
Here are some methods to get yesterday’s date using php. This will return format like 19/02/17. You can get more details from PHP’s date function You can change the -1 to -20 to get the 20 days back.