-
Notifications
You must be signed in to change notification settings - Fork 0
/
news.php
35 lines (33 loc) · 1019 Bytes
/
news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once("config.php");
include("product_head.php");
$query = "SELECT * FROM `news` WHERE type = 'news_title' ";
$result = $mysqli->query($query);
$row = $result->fetch_array(MYSQLI_ASSOC);
$row_cnt = $result->num_rows;
if($row_cnt == 1){
echo "<div class ='title col-md-12'>";
echo "<img src='./pic/".$row['name']."'>";
echo "</div>";
}
echo "</div>";
echo "<div class ='col-md-8'>";
echo "<h3>最新news</h3>";
echo "</div>";
echo "<div class ='col-md-8'>";
echo "<table class='table table-hover'>";
$sql = "SELECT * FROM `news` WHERE type = 'news' ORDER by datetime DESC ";
$res = $mysqli->query($sql);
while($rows = $res->fetch_array(MYSQLI_ASSOC)){
echo "<tbody>";
echo "<td>".$rows['datetime']."</td>";
echo "<td><a href='news_page.php?news_id=".$rows['id']."'>".$rows['name']."</td></a>";
echo "</tbody>";
}
echo "</table>";
echo "</div>";
echo "<div class ='col-md-4'>";
echo "<img src='./pic/".$row['name']."' style='width: 100%;'>";
echo "</div>";
echo "</div>";
include("layout_footer.php");