Category: PHP

When you have the large collection of images files on a directory and you wants to convert it into the photo gallery.

Solution 1

Add image file manually to your page one by one which you want to show. The problem with this solution is it is time-consuming and you have to check all image links if any update in future.

Solution 2

Store image names in the Database table and use it to get images.

Solution 3

Read all files from target directory and generate photo gallery.

The second and third solution are better but in this post, I will show you how to implement the third solution with PHP.

How to make photo gallery from image directory with PHP

Read More How to make Photo Gallery from image Directory with PHP

How To PHP

Pagination is a technique to break and display the large list of content in the smaller parts. This reduces your page load time and it is user-friendly.

There are multiple types of pagination available some are –

In this tutorial, I show How you can add numeric pagination to your web page.

How to make PHP numeric pagination

Read More How to make PHP numeric Pagination

DataBase PHP

There are many things you can do with AJAX to improve the user experience, for example, Add, edit or delete the record and update layout without reloading the page.

Deleting record only using PHP

If you have never used AJAX for deleting before then you either passing the id with $_GET or $_POST methods. Deleting the record when the value is get set.

This works and removes the record but it reloads the page every time.

In this tutorial, I show you How to remove the record from MySQL Table with jQuery AJAX.

What in the demonstration ?

In the demonstration, I am creating the HTML table which shows the list of records with a delete button. When the button gets clicked then removing record and HTML table row with fadeOut() effect.

How to Delete Record from MySQL Table with AJAX

Read More How to Delete Record from MySQL Table with AJAX

AJAX Jquery PHP

Have you ever think to make Live Editable Table that allows your users to quickly modify content and save it.

If you are not using live editing on your web page then you send the user to Edit form page every time when it wants to update its data and after saving take back it to the List page.

This is a time-consuming process and not very user-friendly.

You can do this with jQuery AJAX.

In this tutorial, I show you two ways to make your table columns editable –

  1. Using contentEditable attribute
  2. Showing input element when the user clicks on the cell.

Make Live Editable Table with jQuery AJAX

Read More Make Live Editable Table with jQuery AJAX

AJAX Jquery PHP

You already know that in HTML there is no search option in the dropdown element. When you press any single key on the dropdown then it takes you to the option but not allows you to search whole or particular string.

There are many jQuery plugins which do this for you.

But in this tutorial, I am not using any jQuery plugins for implementing it.

When it’s required?

This kind of feature generally requires when we have the long list of options in the Select element and want to make an easier navigation for users.

By this way, you enable user to search option on dropdown

The most common example is Country Dropdown which you have seen on many websites when you go for Registration.

What in the Demonstration ?

Creating a simple form which also contains a drop-down element. When the dropdown gets clicked then showing the Search Box and according to the input show suggestion.

Make a Dropdown with Search Box using jQuery

Read More Make a Dropdown with Search Box using jQuery

AJAX Jquery PHP

On your Client-side with jQuery, JavaScript you cannot delete any files. You need to use Server-side scripting for doing it.

In PHP, you can simply use unlink() function this removed a file from your server if it exists.

Sometimes you have the requirement to delete a resource file without reloading the page. This cannot total done with PHP you need to use jQuery or JavaScript with it by which you need to send AJAX request to your server for removing a file and according to the response make changes on your Client-side.

What in the demonstration ?

For demonstration purpose, I create a number of <img> element with Delete Button. When the Button gets clicked then removing the file using jQuery AJAX and replace the <img> source with the default image.

How to delete file with jQuery AJAX

Read More How to delete file with jQuery AJAX

AJAX PHP

There are many cases where we have required to update certain part of the web page on the regular basis.

For example – showing live cricket or football score, display latest news feeds,etc.

In this tutorial, I show How to use jQuery AJAX to implementing this.

There are two ways to send AJAX request on specified time –

  • By setInterval() and
  • By setTimeout() JavaScript functions.

Both do the same work but they are reliable for certain cases, which I discuss in this tutorial.

Read More How to fire AJAX Request on Regular Interval

AJAX Jquery PHP

The phpMyAdmin allows us the number of ways to export the Table data one of the ways is CSV(Comma Separated Value).

In this post, I show How you can export MySQL table data as CSV file in PHP.

There are two ways to create a CSV file in PHP –

  • By comma separated string, or
  • using fputcsv() method

In this tutorial, I am using the fputcsv() method which writes an array to the file line by line.
Read More How to Export MySQL Table data as CSV file in PHP

DataBase PHP

We generally require sorting feature in the Table layout when there is many columns or lots of data.

In this tutorial, I show you How you can implement it using AJAX and PHP within your project.

In the demonstration, I am creating a table layout which shows the list of employees and adding click event in header column. Within click, calling a function in which passing column name as an argument and sending AJAX request.

Read More Sorting the Table by clicking Header with AJAX

AJAX Jquery PHP

AJAX Javascript Jquery PHP