Select dữ liệu từ CSDL bằng php hướng đối tượng - MySQL
//
$host = "localhost";
$user = 'root';
$pass = '';
$database = "mpp_simva";//tên csdl
//$page_title = 'Quan ly Doan Vien';
$db = @new mysqli($host, $user, $pass, $database);
if ($db->connect_errno) {
die("Không thể kết nối CSDL <br> " . $db->connect_error);
}
$db->query("SET NAMES utf8");
?>
<!-- START Template Main-->
<section id="main" role="main">
<style type="text/css" media="screen">
.khung-partner:hover{
-moz-box-shadow:4px 2px 2px #696969;
-webkit-box-shadow:4px 2px 2px #696969;
box-shadow:2px 1px 2px 2px #696969;
}
.khung-partner{
border: 1px solid #cccccc;
margin: 5px;
margin-left: 40px;
}
</style>
<h2>DANH SÁCH Ý TƯỞNG</h2>
<!-- START Features Section -->
<section class="section bgcolor-white">
<div class="container">
<!-- START row -->
<?php
$sql = "SELECT * FROM tbl_idea ";
$result = $db->query($sql);
if ($result) {
$i = 1;
$dong = 1;
?>
<div class="row">
<?php
while ($row = $result->fetch_array()) {
if ($dong == 1) {
?>
<div class="col-md-5 khung-partner">
<div class="table-layout animation" data-toggle="waypoints" data-showanim="fadeInRight" data-trigger-once="true">
<div class="col-xs-19 pl15">
Tiêu Đề :<input type="text" value="<?php echo $row['title']; ?>" readonly="true"class="form-control"/>//title là tên cột trong csdl ghi đúng nó mơi ra nhé
Nội Dung Ý Tưởng :<textarea type="text" readonly="true"class="form-control"><?php echo $row['content'] ?></textarea>
<br/> Ngày Gữi : <input type="text" value=" <?php echo $row['date_create'] ?>" readonly="true"class="form-control"/>
<br/>Tên Người Gữi : <input type="text" value=" <?php echo $row['name'] ?>" readonly="true"class="form-control"/>
<br/>Địa Chỉ Nơi Ở : <input type="text" value=" <?php echo $row['addresslive'] ?>" readonly="true"class="form-control"/>
<br/>Địa Chỉ Nơi Làm Việc : <input type="text" value=" <?php echo $row['addressjob'] ?>" readonly="true"class="form-control"/>
<br/>Số Điện Thoại : <input type="text" value=" <?php echo $row['phone'] ?>" readonly="true"class="form-control"/>
<br/>Email : <input type="text" value=" <?php echo $row['email'] ?>" readonly="true"class="form-control"/>
<br/>Hình Thức Tham Gia : <input type="text" value=" <?php echo $row['form_particition'] ?>" readonly="true"class="form-control"/>
<br/><button class="btn btn-success" id="btnDuyet">DUYỆT</button>
</div>
</div>
</div>
<?php
if ($i % 2 == 0) {
$dong = 1;
}
}
//doc 1 du lieu
$i++;
}
}
?>
</div>
<!--/ END row -->
</div>
</section>
<!--/ END Features Section -->
<!-- START To Top Scroller -->
<a href="#" class="totop animation" data-toggle="waypoints totop" data-showanim="bounceIn" data-hideanim="bounceOut" data-offset="50%"><i class="ico-angle-up"></i></a>
<!--/ END To Top Scroller -->
</section>