Shopping cart – PHP | Cookies

In this tutorial, we will teach you how you can create a shopping cart in PHP using cookies. index.php If you run the code now, you will be able to view all products from database along with button to add cart. As we havn’t added any product in cart yet so it will not display …

PHP vs Javascript – Performance test

We are going to do a performance test on getting the data from MySQL database using PHP vs getting data from MySQL database using AJAX in Javascript. We have a database named classicmodels and a table named orderDetails. In both the cases, we are fetching data from MySQL database with the help of PHP. But …

MongoDB tutorials

Learn MongoDB basics from our easy-to-follow tutorials. Table of content: 1. Download and Installation Video tutorial: You can download MongoDB from their official site: https://www.mongodb.com/download-center and you need to select “Community server” if you are using it for localhost or small websites. For a very large company, I would recommend “Enterprise server”. Once downloaded, extract …

Count words as user type – Textarea & Javascript

Demo In this tutorial, we are going to teach you how you can count the number of words in textarea as user type in it. The first thing you need to do is to attach an onkeyup listener to your textarea tag. This function will be called whenever user pressed the key. Specifically, when the …

Shuffle an array of objects – Javascript

To shuffle an array of objects or single values in Javascript, use the following function: First, we are looping through all array elements. data is our array of objects. First, we are saving the current array element in a separate variable named x. Then we are generating a random number. Math.random() will return a random …

Confirmation dialog before deleting data – Javascript, PHP

In this tutorial, we are going to teach you how you can show a confirmation dialog before deleting any data using Javascript. Suppose you are displaying a lot of data in tabular form in the admin panel, and you have a delete button at the end of each row. Now when someone clicks on it, …

Calculate time passed since date in days, hours, minutes and seconds – Javascript, PHP

Demo Convert time to different timezones Today, we will learn to calculate the time passed since date in days, hours, minutes and seconds. Either you are receiving values in PHP variable from MySQL database, or you are calling an AJAX request, this tutorial will help you in both situations. We will also display the hours, …

Calculate remaining time in days, hours, minutes and seconds – Javascript, PHP

Demo Convert time to different timezones Today, we will learn to calculate remaining time till future date in days, hours, minutes and seconds. Either you are receiving values in PHP variable from MySQL database, or you are calling an AJAX request, this tutorial will help you in both situations. We will also display the hours, …

Hashed password change feature – Core PHP

In this article, we will teach you how you can change the hashed password of a user in PHP. Before you proceed, make sure you have PHP version 5 or greater than 5 till 5.5.0 (PHP 5 >= 5.5.0) or PHP 7. You can check your server’s PHP version by creating a new PHP file …