javascript - 回显脚本未启动
问题描述
我正在创建一个论坛。当我尝试回显对帖子的评论时,就会出现问题。该脚本似乎没有做任何事情。
if($result->num_rows>0){
while($row = $result->fetch_assoc()){
$username=$row['username'];
$file=$row['file'];
$text=$row['text'];
$date=$row['date'];
$postId=$row['postId'];
$commentOn=$row['commentOn'];
if($commentOn == 0){
echo'
<li>
<div class="comment">
<p><am>+</am>'.$username.'</a><em>'.$date.'</em> _ #'.$postId.'</p>
<div>
<img src='.$file.'>
<p>'.$text.'</p>
<p><Button>upvote</Button><Button>downvote</Button><form action="upload2.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<textarea name="text" cols="30" rows="2"></textarea>
<textarea id="sov" name="postIdr">'.$postId.'</textarea>
<input type="submit" value="Reply">
</form><ap>Reply</ap></p>
</div>
</div>
<div id="h'.$postId.'"></div>
</li>';
}else{
//Here is where the problem area starts
echo' <script type="text/javascript"> document.getElementById("h'.$commentOn.'").innerHTML = "
<ul>
<li>
<div class="comment">
<p><am>+</am>'.$username.'</a><em>'.$date.'</em> _ #'.$postId.'</p>
<div>
<p>'.$text.'</p>
<p><Button>upvote</Button><Button>downvote</Button><form action="upload2.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<textarea name="text" cols="30" rows="2"></textarea>
<textarea id="sov" name="postIdr">'.$postId.'</textarea>
<input type="submit" value="Reply">
</form><ap>Reply</ap></p>
</div>
</div>
<div id="h'.$postId.'"></div>
</li>
</ul>
";</script>
'; }
}
}
?>
我不明白这是怎么回事。我没有收到任何错误消息,也没有在网页上看到任何内容
解决方案
推荐阅读
- netflix-zuul - Zuul 块头
- android - 带有 targetSdkVersion 27 的谷歌地图 API
- php - mysqli_select_db 数据库错误
- c++ - Spin Control GetPos() 值被延迟
- google-apps-script - TypeError:无法从未定义中读取属性“源”
- javascript - Laravel,如何将此刀片 {{ url(' ') }} 转换为普通的 html?
- django - 将 Django 应用程序部署到 Heroku 时出错
- python - 如何使用 CommentedMap 对 YAML 进行递归排序?
- aws-lambda - 使用无服务器设置从 Windows 部署到 lambda 的文件的执行权限
- python - Pandas - 如何在列中查找一组值,如果存在则返回另一列中的值