我在这里吮吸一些代码。它显示一篇文章,因为它点击了显示标题和内容等的另一个页面的链接。
我的问题是我需要在页面上显示不同的记录集以及此处的内容。
在这种情况下,它将是所有其他标题的列表,这些标题与加载的文章具有相同的“artcampaign”编号。有点像相关文章或此类别中的完整列表。对此有任何帮助。
$sql = "
SELECT articles.id AS articleid, articles.art_title AS title, articles.art_url AS art_url, articles.art_content AS content, campaigns.id, campaigns.camp_title AS camptitle, campaigns.camp_name AS campname, campaigns.camp_url AS camp_url
FROM articles
LEFT JOIN campaigns ON articles.art_campaign = campaigns.id
WHERE art_url = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('s', $_GET['art_url']); // assuming it's a string?
$results = $stmt->execute();
echo "
<h2>{$campname}</h2>
<H3>{$camptitle}</H3>
<H4>{$title}</H4>
";
?>
<div class='right-section'>
<h5><?php echo "{$campname}"; ?> Links</h5>
<ul calss='section-list'>
<li>dummy text</li>
</ul>
</div>
<?php echo "{$content}"; ?>
</div>