Web Development - Page 2 of 9 -

What is Sql – Constraints

What is Sql – Constraints

Constraints are utilized to indicate the principles concerning information in the table. It tends to be connected for single or different fields in a SQL table during the formation of a table or in the wake of making utilizing the ALTER TABLE direction. The imperatives are:

NOT NULL – Not Null Value should be Inserted in the table.
CHECK – Verifies that all values in a field satisfy the given condition.
DEFAULT – Automatically assigns a default value if no value has been specified for the field.
UNIQUE – Ensures unique values to be inserted into the field.
INDEX – Indexes a field providing faster retrieval of Data.
PRIMARY KEY – Column Name uniquely identifies each record in a table.
FOREIGN KEY – Ensures referential integrity for a record in another table.

Search Filter in PHP MYSQL

CRUD Operation with Search Filter Feature

I will show you a full code of CRUD operation with a search filter option. I have used Core PHP for backend and Javascript, CSS and Html for Front-end. I didn’t have used ajax call for sending and receiving requests.

First see the database of this project

id , city and country only 3 coloumns . Now connection code

conn.php

Project Screen Short –

I have divided code into 10 pages Header , footer and source code .

Now I will start from the add.php page it has designing and coding part as well.

I have called the connection of database using require() function of PHP. You can use either include() or include_once() or require() according to your requirements.I am using CDN link to enable Bootstrap functionalities into your code.

Now we will see an index.php page which is your the main page and you have seen this page in the first screen short.

index.php

Now we will see header.php , footer.php , edit.php and delete.php .

header.php

The header page has all cdn links of Boostrap and Jquery.

footer.php

Now we will see update and delete page .

update.php

Now will see delete.php page

delete.php

Now lets see search filter option.

search_action.php

Finally will see style.css .

style.css

How to color background of last inserted row in PHP

Without last_insert_id

I have colored background of last inserted row without using last_insert_id. You can do this by using LIMIT and ORDER BY of MySQL.

Php insert id , php last_insert_id

Database Structure :

id , name , address , gender , designation ,age

Now lets start with our code ,First make this databse table in your database.

In this way you can color the background of last inserted row in php

See our more articles on PHP and JAVASCRIPT

How to make sales receipt in PHP

Pagination in php

Show data from using Drop Down list in PHP

How to show data from Database using drop-down PHP

We can show database value in a table using the dropdown list. Below is a database structure. You can add more data to the database.

Database Structure

idnameaddressgenderdesignation
1RobertLondonMaleProfessor
2DianaMumbaiFemaleEngineer

Now we will see code for dropdown list

This is way we can show data in a table using drop down.

OutPut of the code :

See our more articles on PHP, JAVASCRIPT and JQUERY

How to make sales receipt in PHP

Sales print in php

It’s very easy to make a sale receipt like Amazon in PHP. I am only fetching data from the database so I have used myself. The database Columns name would be – id, name, price, qty (int, varchar, int, int ).

I have multiplied Price into Quantity to get Total Price. Price * Quantity = Total Price.

See More tutorials on PHP and JAVASCRIPT .

Shopping cart in PHP

Shopping cart in PHP

How to make Shopping cart in Core php

I didn’t have used any PHP framework. This shopping cart in core PHP and it is only for beginners. You will see Add to cart, Add to a product, delete a product, preview product, log in, and log-out. I have written a design code on a different page and business logic code on a different page.

Technolgy Used : PHP ,MY-SQL , HTML ,CSS ,BOOTSTRAP ,JAVASCRIPT & JQUERY.

If you run this project in your browser you will see this output. For source code please leave your mail in the comment box.

This is your project structure in your folder. As I said Business logic and design code both have written on different pages.

Now start with a database this is the database design. There are two tables and a total of 9 columns. Save table is used for Registration and Login.

Now I will show you the complete code of connection as know that without connection can’t complete this project.

Save this code as connection.php

Now we will see Sign up page code and login page code. Now see registration.php This page only has designing part and business logic will be on a different page with the name registration_action.php

registration.php

Now you will see business logic of registration page.

registration_action.php


The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion.

Now we will see login page but first, we will see design page of login then business logic.

index.php (Design page of Login Form)

Now we will see business logic of Login form index login_action.php

This is our logout page logout.php

error_reporting(0) is used to avoid warning and notice. Now the next step is to add header and footer page. I didn’t add any menu in the header but there is a menu in the footer but the footer menu is empty.

header.php

footer.php

Now we will see the code of home page which showing four data in the front end. You can add more products but I am showing just four product on each row.

main.php

Now we will see how to add product in main page . There are total 8 coulumns.

This is designing page of add_product page add_product.php

Now see business logic of add_product page product_action.php

How to see product in diffrent page or on model box . view_detail.php

Now, this is our last code of the project, how to remove a product from the main page. empty_cart.php

If you want source code of this project please drop your mail in the comment box.

Multidimensional Array in PHP

Output of the code :

Name #1:Name :Learn PHP from java2s.com 
City :Mumbai 
Year :1999 
Name #2:Name :Learn Java from java2s.com 
City :Nagpur 
Year :1823 
Name #3:Name :Learn HTML from java2s.com 
City :Vasai 
Year :1992 
Name #4:Name :Learn CSS from java2s.com 
City :Nalasopara 
Year :2011 

See more Tutorials on PHP

How to insert checkbox value in multiple rows

This is just an example and just try to unserstand flow of the code .

$chk_id = $chk_box [$i]; This will store id or searial number of each line 1, 2,3,4….so on

Pagination in php

I will show how to do pagination in php

Output of the code :

Check out these tutorials

How to handle JavaScript DOM elements

How to manipulate HTML elements using javascript code

First we have to find html elements.To achieve this we have several ways

Find html element by id , Find html element by class name ,Find html element by css selectors , Find html element by tag.

Work with html element id

By using element id we can find elements in the DOM.

Output of code

Get element by id


I am javascript

How to find HTML element by tag

Tag means like div tag , p tag and other different tags in the html. Now we will target these tags using javascript code.

Output of code

Element by tag


I am javascript

Jquery is a library of javascript