0

这是打开的分类表。

这是oc_posts具有以下列的表:

idPost | idCategory | type | title | description

这是另一个包含oc_posthits这些列的表:

idHit | idPost | hitTime

我想获得点击量的标题列表,一个标题的点击量。完整列表。

我想像在打击示例中一样制作变量

$dynamicList = "";
$sql = mysql_query("SELECT * FROM oc_posts ORDER BY title ASC");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
    while($row = mysql_fetch_array($sql)){ 
            $idPost=$row['idPost'];
                $postType=$row['type'];

                $postTitle=$row['title'];
                $category=$row['category'];//real category name
                $fcategory=$row['fcategory'];//frienfly name category
                $idCategoryParent=$row['idCategoryParent'];
                $fCategoryParent=$row['parent'];
                $postPassword=$row['password'];
                $insertDate=$row['insertDate'];


             $dynamicList .= '<table width="1000" border="0">
  <tr>


    <td width="800">' .$postTitle.'<a href="http://capitalclassified.com/manage/?post='.$idPost.'&amp;pwd='.$postPassword.'&amp;action=delete">Delete</a></td>
    <td width="150">'.$insertDate.'</td>
    <td width="50"><div class="bannerad">
<a href="http://capitalclassified.com/manage/?post='.$idPost.'&amp;pwd='.$postPassword.'&amp;action=edit">Edit</a>
</div> </td>
<td width="50"><div class="bannerad">
<a href="http://capitalclassified.com/manage/?post='.$idPost.'&amp;pwd='.$postPassword.'&amp;action=delete">Delete</a>
</div> </td>


  </tr>
</table>';
}
// if successful redirect to delete_multiple.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=listing.php\">";
}
}
mysql_close();
?>
4

1 回答 1

0

SELECT ops.*, oph.hitTime FROM oc_posts ops, oc_posthits oph WHERE oph.idPost = ops.idPost

你想要的是这样的东西吗?

于 2012-07-05T04:14:51.337 回答