我喜欢和不喜欢的计数器适用于第一篇文章,但不适用于我的第二篇文章。
sweettune.info/hashtest/red/index.php
“喜欢”和“不同”计数器在localhost中可以很好地工作,但是当我将其上载到GoDaddy时,它不起作用。
我正在使用mysqli_fetch_array($result, MYSQLI_ASSOC);
。但是,当我将其更改为mysqli_fetch_assoc($result);
时,出现页面无法正常工作的错误。
<div class="posts-wrapper">
<?php foreach ($posts as $post): ?>
<div class="post">
<?php echo $post['text']; ?>
<div class="post-info">
<!-- if user likes post, style button differently -->
<i <?php if (userLiked($post['id'])): ?>
class="fa fa-thumbs-up like-btn"
<?php else: ?>
class="fa fa-thumbs-o-up like-btn"
<?php endif ?>
data-id="<?php echo $post['id'] ?>"></i>
<span class="likes"><?php echo getLikes($post['id']); ?></span>
<!-- if user dislikes post, style button differently -->
<i
<?php if (userDisliked($post['id'])): ?>
class="fa fa-thumbs-down dislike-btn"
<?php else: ?>
class="fa fa-thumbs-o-down dislike-btn"
<?php endif ?>
data-id="<?php echo $post['id'] ?>"></i>
<span class="dislikes"><?php echo getDislikes($post['id']); ?></span>
</div>
</div>
<?php endforeach ?>