Web Assignment 4
Web Assignment 4
Web Assignment 4
Database:
Code:
<table cellpadding="5" cellspacing="10" align="center">
<center>
<h3>
Students Registration
</h3>
</center>
<tr>
<td>
Reg_no:
Semester:
</td>
</tr>
<tr>
</td>
</tr>
</form>
</table>
<?php
$db=mysqli_select_db($connection, 'registration');
if (!$db){
echo mysqli_error($connection);
if($_POST){
$re=$_POST['reg_no'];
$na=$_POST['name'];
$em=$_POST['semester'];
$query=mysqli_query($connection,$insert);
if (!$query){
echo mysqli_error($connection);
}else{
?>
<center>
<h3>
Update Data
</h3>
</center>
<tr>
<td>
Reg_no
</td>
</tr>
<tr>
<td>
Name:
</td>
</tr>
<tr>
<td>
Semester:
</td>
</tr>
<tr>
</td>
</tr>
</form>
</table>
<?php
$db=mysqli_select_db($connection, 'registration');
if(!$db)
echo mysqli_error($connection);
if($_POST)
$reg_no=$_POST['reg_no'];
$name=$_POST['name'];
$semester=$_POST['semester'];
$update=mysqli_query($connection, $update);
if(!$update)
echo mysqli_error($connection);
}
else
?>
<center>
<h3>Delete Data</h3>
</center>
<tr>
<td>
Name :
</td>
</tr>
<tr>
</td>
</tr>
</form>
</table>
<?php
$connection=mysqli_connect("localhost","root","");
$db=mysqli_select_db($connection,'registration');
if(!$db)
echo mysqli_error($connection);
if ($_POST)
$name=$_POST['name'];
$delete=mysqli_query($connection,$delete);
if(!$db)
echo mysqli_error($connection,$delete);
else
}
Insert Query:
Update Query:
Delete Query:
Select Query:
<head>
<title>Select</title>
</head>
<style type="text/css">
th
text-align: center;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
td
text-align: center;
padding-right: 50px;
padding-left: 50px;
padding-top: 10px;
padding-bottom: 10px;
</style>
<?php
$db=mysqli_select_db($connection, 'registration');
if(!$db)
{
echo mysqli_error($connection);
if($query2=mysqli_query($connection, $query))
if(mysqli_num_rows($query2)>0)
echo "<table>";
echo "<tr>";
echo "<th>Reg</th>";
echo "<th>Name</th>";
echo "<th>Semester</th>";
echo "</tr>";
while($row=mysqli_fetch_array($query2))
echo "<tr>";
echo "<td>".$row['reg_no']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['semester']."</td>";
echo "</tr>";
echo "</table>";
else
mysqli_close($connection);
?>