CREATE TABLE `student_details` ( `id` int(11) NOT NULL, `name` varchar(100) DEFAULT NULL, `email` varchar(45) DEFAULT NULL, `contact_no` varchar(45) DEFAULT NULL, `gender` varchar(45) DEFAULT NULL, `qualification` varchar(45) DEFAULT NULL, `address` varchar(450) DEFAULT NULL, `create_date` timestamp NULL DEFAULT current_timestamp() )DATABASE CONNECTION
<?php define("DEMO_PORT","3306"); define("DEMO_CharSet","utf8"); define("DEMO_USER",'root'); define("DEMO_HOST",'localhost'); define("DEMO_PASS",''); define("DEMO_DB","student"); ?>
fetch.php
<?php include 'DBConnect/MysqliDb.php'; ?> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <div class="container"> <div class="row centered-form"> <div class="col-xs-10 "> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Data Fetch From Database Using PHP PDO</h3> </div> <div class="panel-body"> <table class="table table-bordered"> <thead style="background-color: #677ba2; color: #fff;"> <tr><th>Sr.No</th> <th>Name</th> <th>Email</th> <th>Contact-No</th> <th>Gender</th> <th>Qualification</th> <th>Address</th> </tr> </thead> <tbody> <?php $fetch = "SELECT id,name,email,contact_no,gender,qualification,address from student_details"; $myDB= new MysqliDb(); $result=$myDB->Query($fetch); $count=1; if($result =="0") { echo "No Data Found"; } else { foreach($result as $key=>$value) { echo '<tr class="data"> <td class="data" width="25px">'.$count.'</td> <td class="user_type">'.$value['name'].'</td> <td class="name">'.$value['email'].'</td> <td class="user_id">'.$value['contact_no'].'</td> <td class="password">'.$value['gender'].'</td> <td class="password">'.$value['qualification'].'</td> <td class="password">'.$value['address'].'</td> </tr>'; $count++; } } ?> </tbody> </table> </div> </div> </div> </div> </div> <style type="text/css"> body { background-color: #fff; } .centered-form { margin-top: 60px; } .centered-form .panel { background: rgba(255, 255, 255, 0.8); box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px; } </style>