You are on page 1of 29

Web Engineering

Presentation
Topics:
Database connectivity

Data insertion
Database Connectivity
• First we know how to make database then we able
to connect the database with php
• To Connect the php with database we have
certain steps.
Step1:
• Open the Xampp/Wamp Control Panel.
Step1:
• Start the Apache and MySQL.
Step 3:
• After star the Apache and MySQL then open the
Mozila firefox or Google Chrome and type this
• Localhost/xampp/
Step 4:
• When you enter the localhost/xampp/.
• Then the main page of Xampp will open like this.
Step 5:
• Now click on phyMyAdmin.
• When you click on phyMyAdmin then you see like
page this
Step 6:
• Now click on database and create the database
like this.
Step 7:
• After creating the database next step is make the
table and set the no. of columns.
• And click on go
Step 8:
• Fill the data like this
Php and Database Connectivity
• So by followings the above steps we make our
database.

• After making the database we have to connect


php with databas.

• The open notepad++ or simple notepadd and start


coding and connect to php which we will tell you in
the upcoming slides.
• We make a data base of school in which we enter
the information of students.

• To just understand you the whole process.

• For this we first made the database in my sql


• After making our database we make the two
notepad files .
• Make the notepad

• One is in html that is front-end.

• And other is in php which is back end



Front-end html class
<html>

<head>

<title> School Data </title>

</head>

<body>

<form action="sup.php" method="post">

<table width="600" border="6" align="center">

<tr>
<td bgcolor="green" colspan="6">
<h1>Students Registration</h1>
</td>

</tr>
<tr>

<td>Studend name</td>
<td><input type="text" name="sname"/></td>

</tr>

<tr>

<td>Section</td>
<td><input type="text" name="section"/> </td>

</tr>

<tr>

<td>roll no </td>
<td><input type="text" name="roll_no"/> </td>

</tr>
<tr>

<td>school name</td>
<td><input type="text" name="school_name"/> </td>

</tr>

<tr>

<td>result</td>
<td><input type="text" name="result"/> </td>

</tr>

<tr>

<td>Submit</td>
<td><input type="submit" name="submit" value="submit"/> </td>

</tr>
</form>
</body>

</html>
• This html class is our front-end class which is appear
on web page in which we enter the student data
and submit.
• We made the html file which is front-end and
appear on the web page and insert the data data
of student .

• But we still can’t connect to the mysql dataabse to


connect to database we make annother file of
notepad of php type in which we connect to
database.

• In the next slide we will show you our php code who
is connect to mysql data base
• To Connect to database we have to write the
syntax like this.

• $con = mysqli_connect("localhost","root","","school1");

• In above syntax loclahosht and root is our path and school1 is


our db name.

• We will show you more by our db which we made.


• Now fill the form and submit it and your data will
insert into your db.
• You can also edit and delete the database data .

You might also like