当单击“Paging.php”中的某个图像时,我想增加一个页面浏览量(“num_views”)数据库值,这样我就可以跟踪该图像被查看了多少次
分页.php:
while ($imageCounter < $imagesPerPage && ($row = $catResult->fetch_assoc())) {
echo "<br />ID: " . $row['imgid'] .
'<br /><a href="./templates/viewcomic.php?views='. $row['num_views'].'&id=' . $row['imgid'] . '&image=' . $imgpath.$row['imgname'] . '"><img src="' . $thumbpath.$row['imgthumb'] . '"/></a>' .
"<br />CATFK: " . $row['catfk'] .
"<br/>";
$imageCounter++;
}
ViewComic.php
<?php
include 'include/header.php';
$imgid = $_GET['id'];
$views = $_GET['views'];
include '../scripts/dbconnect.php';
$mysqli->query("UPDATE child_images SET num_views = ($views+1) WHERE imgid = $imgid");
mysqli_close($mysqli);
?>
虽然它似乎没有增加