我的这种询问显示,我的“页数”在动态表格中,但显示所有页数,但我只想限制“页数”以显示其“运动”栏与目前的“运动”栏相匹配。
这是显示数据的问题:
$counter=1; $userID=PageDB::getInstance()->get_user_id_by_name($_SESSION[ user ]); $result=PageDB::getInstance()->get_pages_by_campaign_id($campaignID);
$i=0;
while ($row = mysqli_fetch_array($result)):
$style = "";
if($i%2==0)
{
$style = style="background-color: #EFEFEF" ;
}
echo "<tr".$style.">";
echo "<td>" . htmlentities($row[ pid ]) . "</td>";
echo "<td>". htmlentities($row[ id ]) . "</td>";
?>
<td>
<form style="display:none;"></form>
<form name="editPage" action="editPage.php" method="GET">
<input type="hidden" name="pageID" value="<?php echo $pageID = $row[ pid ]; ?>" />
<input type="submit" name="editPage" value="<?php echo "Page " . $counter; ?>" style="padding-top:4px; padding-bottom:6px;background:none;border:none; cursor:pointer"/>
</form>
</td>
<?php
$pageID = $row[ pid ];
$counter++;
$i++;
echo "</tr>
";
endwhile;
mysqli_free_result($result);
?>
在这方面,我是如何询问数据库的。
public function get_pages_by_campaign_id($campaignID) {
$campaignID = $this->real_escape_string($campaignID);
return $this->query("SELECT pid,campaignid,id,campaign_name FROM pages,campaigns WHERE pages.campaignid = campaigns.id ORDER BY campaigns.id LIMIT 1,10");
}
As I said it is returning the right data, but I only want to display the data where: pages.campaignid = campaigns.id [1] or pages.campaignid = campaigns.id [r] etc...