เดิมเป็น code ที่ใช้งานได้ใน php5 แต่ตอนนี้ host อัพเป็นเวอร์ชั่นphp7 ทำให้ไม่สามารถแสดงผลได้ จึงได้แก้ไข code แต่ก็ยังใช้งานไม่ได้
code นี้ต้องแก้ตรงไหนถึงจะแสดงผลได้ใน php7 รบกวนท่านที่มีความรู้ช่วยดูหน่อย
Code
<?php
$current_page = 1;
if(isset($_GET['page'])) {
$current_page = $_GET['page'];
}
$rows_per_page = 16;
$start_row = paging_start_row($current_page, $rows_per_page);
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM gallery order by id DESC
LIMIT $start_row, $rows_per_page;";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
$found_rows = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT FOUND_ROWS();");
$total_rows = mysqli_result($found_rows, 0, 0);
$error_message = "";
if($total_rows == 0) {
$error_message .= "ไม่มี";
}
else {
$stop_row = paging_stop_row($start_row, $rows_per_page, $total_rows);
}
?>
<?php
$pic = array();
$q = @mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,Name,Picture,Message,Tel FROM gallery WHERE 1 ORDER BY viewed DESC LIMIT 8");
while($q = @mysqli_fetch_assoc($result)) {
$pic[] = array(
'id' =>$q['id'],
'name' =>$q['Name'],
'image' =>$q['Picture'],
'message' =>$q['Message'],
'Tel' =>$q['Tel']
);
}
@((mysqli_free_result($q) || (is_object($q) && (get_class($q) == "mysqli_result"))) ? true : false);
?>
<?php
for($j = 0 ; $j < sizeof($pic); $j = $j + 1){ ?>
<?php
for($i = $j ; $i < ($j+1); $i++){ ?>
<div class="col-lg-3 col-md-6 d-flex align-items-stretch mt-4 mt-md-0">
<div class="course-item">
<a href="view_duab.php?id=<?php echo $pic[$i]['id'];?>&search=<?php echo $pic[$i]['name']; ?>">
<img src="timthumb.php?src=imagesview/<?php if ($pic[$i]['image']==""){ echo "avatar.jpg";}else { echo $pic[$i]['image'];}?>&w=400&h=500&zc=1" alt="<?php echo $pic[$i]['name']; ?>"title="<?php echo $pic[$i]['name']; ?>" class="img-fluid" alt="">
<div class="course-content">
<div class="d-flex justify-content-between align-items-center mb-3">
<h4><?php echo $pic[$i]['Tel']; ?></h4>
<p class="price"><?php echo $pic[$i]['id']; ?></p>
</div>
<h5><?php if ($pic[$i]['name']==""){ echo "No DATA";}else { echo $pic[$i]['name'];} ?></h5>
<p><?php if ($pic[$i]['message']==""){ echo "ไมมีข้อมูล";}else { echo $pic[$i]['message'];} ?></p>
<div class="trainer d-flex justify-content-between align-items-center">
<div class="trainer-profile d-flex align-items-center">
<img src="timthumb.php?src=imagesview/<?php if ($pic[$i]['image']==""){ echo "avatar.jpg";}else { echo $pic[$i]['image'];}?>&w=320&h=320&zc=1" alt="<?php echo $pic[$i]['name']; ?>"title="<?php echo $pic[$i]['name']; ?>" alt="">
<span></span>
</div>
<div class="trainer-rank d-flex align-items-center">
<i class='bx bxs-message-rounded-detail'></i> <?php $sql = "select * from gallery_ans where id='".$pic[$i]['id']."' order by id_ans";
$dbquery = @mysqli_query($GLOBALS["___mysqli_ston"], $sql);
// หาจำนวนเรกคอร์ดข้อมูลในตาราง
$num_rows = @mysqli_num_rows($dbquery);
if($num_rows==''){
echo "0";
}
else {
echo "$num_rows";
}
?>
<i class='bx bxs-show'></i> <?php $sql = "select * from gallery where id='".$pic[$i]['id']."'";
$dbquery = @mysqli_query($GLOBALS["___mysqli_ston"], $sql);
$result = @mysqli_fetch_assoc($dbquery);
$Viewed = $result[viewed]; echo " $Viewed View"; ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
}
?>
</div>
<br>
<div class="blog-pagination" data-aos="fade-up">
<?php
//แสดงหมายเลขเพจ
$page_range = 4;
$qry_str = "";
$total_pages = paging_total_pages($total_rows, $rows_per_page);
$pagenum = paging_pagenum($current_page, $total_pages,
$page_range, $qry_str);
echo "page: " . $pagenum;
?>
Tag : PHP, MySQL
ประวัติการแก้ไข 2021-11-23 16:57:59 2021-11-23 16:59:14
Date :
2021-11-23 16:50:14
By :
ผู้ใช้งาน
View :
839
Reply :
5
เปิดแสดง error ให้หมดทุกอย่าง แล้วมันแจ้งตรงไหนก็แก้ตรงนั้น
Date :
2021-11-23 18:33:53
By :
mr.v
Load balance : Server 02