使用sql和php回送文章
有没有一种方法可以使用php来回显以下HTML,并用存储在sqlquery中的结果替换H2文本和p文本使用sql和php回送文章,php,Php,有没有一种方法可以使用php来回显以下HTML,并用存储在sqlquery中的结果替换H2文本和p文本 <article class="frEvent" onclick="loadPopup('#frpopup1')"> <!-- Documented within the linked script file. --> <h2 class="frEventHeadline">FR Event</h2> <hr class="
<article class="frEvent" onclick="loadPopup('#frpopup1')"> <!-- Documented within the linked script file. -->
<h2 class="frEventHeadline">FR Event</h2>
<hr class="frEventDivider">
<p class="frEventTagLine">25/12/2012</p>
</article>
$sqlget = "SELECT * FROM frEvents WHERE date >= DATE(now());";
$sqldata = mysqli_query($dbcon, $sqlget) or die('error getting service listings');
您需要将此作为代码的下一部分:
while($row=$result->fetch_assoc()){
echo '
<article class="frEvent" onclick="loadPopup(\'#frpopup'.$row['yoursidrow'].'\')">
<h2 class="frEventHeadline">'.$row['yourseventrow'].'</h2>
<hr class="frEventDivider">
<p class="frEventTagLine">'.$row['yoursdaterow'].'</p>
</article>';
}
对到目前为止你试过什么?我推荐regex。str_替换也是一个选项。请告诉我们你试过什么。Stackoverflow并不是免费为您提供解决方案的,社区之所以能够生存下来,是因为每个人都首先要自己努力:阅读和阅读。嗨,我知道需要自己的研究,但我真的没有地方可以开始。不管怎样,在今天早上接受建议并尝试了一些事情之后,最终的代码看起来是这样的。。。结果是一个解析错误。你需要修正你的报价。非常感谢你的帮助。我不知道为什么,但是while语句在我将其更改为:while$row=mysqli\u fetch\u array$sqldata,mysqli\u ASSOC之前不起作用。在我做出更改之前,页面拒绝加载。