PHP Join Coding
PHP Join Coding
php
============================
<?php
include("connection.php");
error_reporting(0);
?>
<html>
<body>
?>
</body>
</html>
=================================================================
Connection.php
==================
<?php
$servername="localhost";
$username="root"; $password="";
$dbname="school";
$conn=mysqli_connect($servername,$username,$password,$dbname); if($conn)
{
echo "";
}
else
{
echo "Connection Failed";
die("connection failed because".mysqli_connect_error());
}
?>
====================================
display.php
<html>
<style>
td{
padding:10px
}
</style>
<?php
include("connection.php");
error_reporting(0);
$query="select * from student";
$data= mysqli_query($conn,$query);
$total=mysqli_num_rows($data);
if($total!=0)
{
?>
<table border="1" cellspacing="5">
<tr>
<th>Firstname</th>
<th>LastName</th>
<th>FatherName</th>
<th>Email</th>
<th>Password</th>
<th colspan="2">Opeartion</th>
</tr>
<?php
while($result=mysqli_fetch_assoc($data))
{
echo "
<tr>
<td>".$result['fname']."</td>
<td>".$result['lname']."</td>
<td>".$result['fatname']."</td>
<td>".$result['email']."</td>
<td>".$result['pass']."</td>
<td>Edit</td>
<td>Delete</td>
</tr>";
}
}
else{