PHP Tutorials

Import CSV data to table with PHP

Import CSV data to table with PHP

As Import and Export is an important functionality of a website and we have already discussed about how to Export data to CSV file in php. So in this tutorial I will show you how to import CSV data to table with PHP. First we need to read the CSV file using fopen function like below: Now to get row from CSV file we need to use fgetcsv function like below: …

Continue reading

Export data to CSV file in php

Export data to CSV file in php

In many website’s admin section, import/export functionality is required, so you can get and update the records quickly as per your requirement. So today in this tutorial I will show you how to export data to CSV file in php. You can use following code as it is if you want to export a table, you just need to change the database and table name. This is a simple program …

Continue reading

Convert an email into link from text in PHP

Convert an email into link from text in PHP

In some websites, when we add comment with email then email automatically converts into a link, So today I am showing you how to convert an email into link from text in PHP. As ereg_replace() is deprecated in PHP 5.3 you should use preg_replace like below: Now you can use above function like below: And output will be:

Remember me feature using cookies in PHP

Remember me feature using cookies in PHP

Remember me feature is used with the login form to store username and password using cookies, so the form gets auto filled with these when we get the form on browser. So, Today I am going explain how to use Remember me feature using cookies in PHP. First add a remember me checkbox to your login form like below: Now add following code to your login function after user submits …

Continue reading

Take Photo Using Web Camera in PHP

Take Photo Using Web Camera in PHP

Recently I have implemented take photo using web camera in my website for the profile photo. I found jQuery webcam plugin for the same. With this plugin image can be display to canvas to store the image on the server. So in this tutorial I am giving simple steps to implement take photo using web camera in PHP with live demo. First we need to add following scripts in head …

Continue reading

Some Tricks to Sort Out the utf-8 Problem

Some Tricks to Sort Out the utf-8 Problem

Everyone already knows about utf-8 problem, but sometimes the issue still persists even after approaches so many solutions. So in this tutorial I am including some tricks that will surly help you to sort out the utf-8 problem. Like the problem with currency symbols(£, ₹), the solution is based on HTML, PHP and MySQL tricks. In PHP you should use following line: You can set content type using following meta …

Continue reading

Save Base64 Encoded image to file using PHP

Save Base64 Encoded image to file using PHP

When you are handling API for apps ( iPhone, android, etc ), you can see that they provides the image in Base64 encoded format mostly, so we need to save base64 encoded image to server as a image file. This tutorial will let you know how to save Base64 encoded image to server as a image file using PHP. If you are getting the image data with image type like …

Continue reading

System File Path instead of URLs in Magento

System File Path instead of URLs in Magento

Recently I found a problem with CSS and JavaScript paths in Magento when I was moving the code from one hosting to another hosting. When I completely moved the code and database I visited the admin url and front url I found CSS and JavaScript was not loading. When I checked the HTML source I found that Magento using system file path instead of urls and the HTML source code …

Continue reading