我在stackoverflow中找到此代码,我已设法修复它以将其添加到数据库中。
但显示投票的VoteRate无效。
我正在使用此代码:
$db = new PDO('mysql:database=xxxxx;host=localhost', 'xxxxxxxx', 'xxxxxxxx');
$sth = $db->prepare("SELECT add_iP FROM PostsRating WHERE questions_id = :id");
$sth->execute(array(':id' => $_GET['id']));
$clicked = $pluswhite = $ratewhite = '';
if ($sth->fetchColumn()) {
$clicked = " clicked";
$pluswhite = " PlusWhiteButton";
$ratewhite = " RateCountWhiteButton";
}
<span class="up vote<?php echo $clicked; ?>" name="voteup" id="<?php $_GET['id']; ?>">
<span class="plus<?php echo $pluswhite; ?>">+</a>
<span class="rateCount<?php echo $ratewhite; ?>"><?php echo $VoteRate; ?></a>
</span>
我希望有人能帮助我提出意见