我有一个 PHP脚本,显示数据库中的记录.它可能不是最好的脚本,因为我对php很新.
我在表格中添加了一个额外的列,并希望在该列中保留一个计数,以显示每个记录的查看次数.
下面是代码的一部分我认为我需要添加代码…如果我需要发布整个页面我会,但我只是想我可以添加到这部分的行.
//Get the details from previous page
$SelectedCounty = $_POST["result"];
//set variable for next SEARCH
$option = '';
// Get the county names from database - no duplicates - Order A-Z
$query = "SELECT DISTINCT tradingCounty FROM offers ORDER BY tradingCounty ASC";
// execute the query, $result will hold all of the Counties in an array
$result = mysqli_query($con,$query);
while($row = mysqli_fetch_array($result)) {
$option .="" . $row['tradingCounty'] . "";
}
}
新列名称是’views’,我只想在每次查看数据库中的记录时添加1.
任何帮助非常感谢.