jQuery UI autocomplete with PHP and AJAX

The autocomplete functionality shows the suggestion list according to the entered value. You can choose a suggestion from the list. With jQuery UI you can easily add autocomplete widget to the input element. You can use your mouse or keyboard arrow keys to navigate the suggestion list. The widget has various options for customization.

You can set the suggestion source value while initializing the widget. This means it will search for values within the given source value whenever the user types any character. Alternatively, you can make it dynamic with AJAX.

In this tutorial, I show how you can add jQuery UI autocomplete on the textbox and select single or multiple values from the suggestion list.

jQuery UI autocomplete with PHP and AJAX

Read more

Remove unwanted whitespace from the column – MySQL

There is always the possibility that the users may not enter the values as you expected and the data is saved on the Database table. E.g. unwanted whitespace or characters with the value.

You will see the issue when you check for duplicate records or sort the list.

MySQL has some string functions that you can use to eliminate the extra space or characters from the field.

Remove unwanted whitespace from the column - MySQL

Read more

Upload and store an image in the Database with PHP

Uploading and storing an image in a database using PHP is a common task in web development. By storing images directly in the database, you can easily manage, retrieve, and manipulate image data alongside other relevant information. This simplifies data backup and recovery processes and ensures data integrity.

In this article, I will show you 3 approaches to accomplish this –
1. Storing image files by saving their file path or name,
2. Encoding images as base64, and
3. Storing images as BLOB (Binary Large Object) data.

Additionally, we will delve into the retrieval process to display the uploaded images from the database.

By the end of this article, you will have a better understanding of various techniques to upload images to a database and retrieve them for display on your web application.

Upload and store an image in the Database with PHP

Read more