当我单击与该行关联的批准按钮时,我正在尝试更新我的 phpmyadmin 数据库中的一行
这是我要批准的行:
1、星名=问题-谁问[赞成按钮] [不赞成按钮]
这是我的 db_replicator.php:
<?php
include("db_conn.php");
$sql = "update questions set approved = 1 where questionID = ?";
$qc = $pdo_conn->prepare($sql);
$qc->execute(array($_POST['questionID']));
echo 'saved';
?>
这是我的views.php顶部的函数:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
function save_a(id){
$.post('db_replicator.php', {questionID:id}, function(result) {
alert(result);
window.location.reload();
});
}
</script>
这是我的views.php 上的代码:
echo "<br><b>new questions: {$row4['count']}</b><br>";
while ($row44 = $prep44->fetch(PDO::FETCH_ASSOC)) {
echo "{$row44['questionID']} , {$row44['starName']} = {$row44['question']} - {$row44['whoAsked']}
<button onclick='save_a({$row44['questionID']})'></button><button>Disapprove</button><br>";
}