Display data horizontally from MySQL table

Generally we fetch data from MySQL table and display the fetch records in rows one by one. But sometimes we need to display the records horizontally as per the image below.

Sir Isaac Newton Leonardo Vinchi William Shakespeare
Adolf Hitler Siddhartha Gautama Ian McKellen
Abraham Jesus of Nazareth Walt Disney

It’s not a tough job. You can see that the records are pulling up and displaying 2 records in a row and after that in the next rows for the next 2 records. The code for such display style is as follows:

Continue Reading

How to generate thumbnails image on the fly with PHP

Thumbnail-Genertion-Banner

Many a time we need to create thumbnails of the uploaded images on the fly. In PHP we can create thumbnail at the time of uploading image.

The PHP functions you need to know about for this script.

Steps to generate thumbnails.

  1. Make a folder named ‘images’ inside your web directory.
  2. Make a sub folder named ‘thumbs’ inside‘images’ folder’.
  3. Create a PHP page for example‘thumbnail.php’ inside your root folder.
  4. Now place the following codes in‘thumbnail.php’.
    It’s done. Now run the thumbnail.php file through your browser http://yourdomain.com/thumbnail.php
Continue Reading