0

これは開いている分類されたテーブルです。

oc_postsこれは、次の列を持つテーブルです。

idPost | idCategory | type | title | description

oc_posthitsこれは、次の列を持つ別のテーブルです。

idHit | idPost | hitTime

ヒット数のあるタイトルのリスト、1つのタイトルのヒット数を取得したい。完全なリスト。

ブローの例のように変数を作りたい

$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 に答える