How to Fetch Data From Mysql Database using PHP

How to Fetch Data From Mysql Database using PHP, from inserted data in Mysql database.

HTML Code

<div class="table">
	<div class="tab1"><h1>Name</h1></div>
    <div class="tab1"><h1>Father name</h1></div>
    <div class="tab1"><h1>Mother name</h1></div>
    <div class="tab1"><h1>E-mail</h1></div>
    <div class="tab1"><h1>Address</h1></div>
    <div class="tab1"><h1>DOB</h1></div>
    <div class="tab1"><h1>Category</h1></div>
    <div class="tab1"><h1>Image</h1></div>
    <div class="tab1"><h1>Action</h1></div>
    <div class="tab1"><h1>Delete</h1></div>
    
<?php $query1 = "select * from table";
$query2 = mysql_query($query1);
while($row = mysql_fetch_array($query2)) {  ?>
    
    
    <div class="tab1"><h1><?php echo $row['name'];?></h1></div>                                     
    <div class="tab1"><h1><?php echo $row['father_name'];?></h1></div>                                    <!--from database-->
    <div class="tab1"><h1><?php echo $row['mother_name'];?></h1></div>
    <div class="tab1"><h1><?php echo $row['e_mail'];?></h1></div>
    <div class="tab1"><h1><?php echo $row['address'];?></h1></div>
    <div class="tab1"><h1><?php echo $row['dob'];?></h1></div>
    <div class="tab1"><h1><?php echo $row['category'];?></h1></div>
    
<?php } ?>
</div>

CSS Code

.table{
height:400px;
width:100%;
float:left;
}

.tab1{
width:9.5%;
height:42px;
border:1px #000000 solid;
float:left;
}
.tab1 h1{
width:70px;
height:20px;
font-size:18px;
float:left;
margin:0px;
padding:0px 30px;
}
.tab1 h2{
width:89.5px;
height:20px;
font-size:18px;
float:left;
margin:0px;
padding:0px 15px;
}

How to Update Data into Database using PHP

Leave a Reply

Your email address will not be published. Required fields are marked *