我是 PHP 新手,所以这可能是我错过的明显事情。我试图制作一个按钮来增加数据库中的值:
<?php
$alist = mysqli_query($conn, "SELECT * FROM `posts` ORDER BY `posts`.`id` DESC");
$results = mysqli_num_rows($alist);
if ($results > 0){
while($row = mysqli_fetch_array($alist)) {
echo $row['uid']. " says: ".$row['postText']." <button onclick=".mysqli_query($conn, "UPDATE `posts` SET `postLikes` = postLikes+1 WHERE uid = ".$row['uid'])." name='likebtn'>👍</button>".$row['postLikes']."<br>";
}
}
?>
制作按钮的部分位于第 6 行,我只是想找到如何使用按钮 mysqli_query单击, 我已经尝试过:“https://stackoverflow.com/questions/3862462/php-mysql-run -query-on-button-press-click”但没有结果
提前致谢
ABOUTYOU
慕妹3242003