How to Create Like & Unlike code like FB using PHP, MySQL and jQuery

In this tutorials we are going to learn How to Create Like & Unlike code using PHP, MySQL and jQuery.

Rating system is very useful for every web project. Through this system, web admin can track the visitors like and dislike. Also it will help webmaster to understand the visitors choices and make their website more interactive with the visitors.

Demo       |

We have made the simple rating or like or unlike code system using PHP, MySQL, jQuery and Ajax. This rating system take the visitors like or dislike with jQuery and Ajax.

Step 1: Create database ‘like’ table using MySQL query.

Step 2: Create database ‘products’ table using MySQL query.

Step 3: Connect Db function with db coding.

Step 4: Index.php files have Main file show products list and and like buttons:

Step 5: Create style for css.

Add jquery code and and css link for in the code.

This is the simple and easy code for like and unlike system I hope you guyz like this please share your feedback in comments. If you face any issue please fee free to comment below.

Live search in PHP and Mysql using Jquery

This tutorials is to know how to integrate live search in php and MySQL using jquery. Searching is one of the most required feature in web sites and if it will be live searching it will show you fast result on page. In this tutorial we will create a database and a table insert records and start searching in it.

Demo       |

This is a very simple script which has 2 files. One is an HTML (index.php) file with a Search input box and the second is a PHP (do_search.php) file that has a regular MySQL connect(db.php) and a select statement to get the data from database. This script also has a Loading message shown while the data is being pulled from MySQL. Please note that live search might use more resources from your server. It might result in server overload / slowness if your infrastructure is limited.

Step1 : Setup your database and table in MySQL
Before you run this script make sure you have created a database and table in MySQL. Below is the sample sql command to create a database, table, and insert some dummy rows.

Step 2: Index page for search form. 
Create the live form for searching.

Step 3: Creating a do search for getting data from database.
Create the mysql query for getting the data from table using like” options.

Step 4: jquery code for get the search value and pass to do_seach page. 
Using the jquery you can get the search word and pass to the next page using variable and post method.

Step 4: Add css code fro your design.

You can now demo the script and get the live code., That’s it enjoy the code. Please subscribe. 

We have faced some problem that we mysql table pulling entire table but we need a particular nth row order. Suppose we have lot of row in the table like 1000 rows but we need nth order row only, In this case, here is the code how to select every n-th row,  you can get particular n order

Demo                            Download

n_th order like

Step 1:  Consider the same table in previous post

nth_order show in mysql

Step 2 : very simple method

Here showing the nth order in even and odd id, that’s it very simple

nth_order show in mysql in even

or Another method for sorting nth order is

Set @row as 1 and add with rownum the div with your nth order

Enjoy code

Many of us struggle with how to display mysql rows as columns. For example, having student details and subject and mark in a table. we need to show student, and is each subject in a column. here we going to discuss how to Display rows as columns in table using php and mysql

Demo                                                Download

Step 1:

We have a table with details like the image bellow.

how to display row as column

or here is the code for table

Step 2 :

Here is the mysql code for select row as column

So above code is simply set ‘Subject’ column as each subject like ‘english,maths..’ compare with ‘mark’ using “MAX” keyword and print maximum to minimum values as each column.

Output look like bellow image

so above code is simply

That’s it. enjoy code