Listview gridview

时间:2014-11-03 05:07:13

标签: php listview gridview

我有一个网站,我显示多个产品,这些产品动态填充并显示在查询数据库中。该页面使用php。对于我的生活我不能得到一个gridview和listview按钮使用PHP变量...基本上我填充像这样的变量

我需要使用页面上的gridview / listview按钮组显示以下变量... HELP !!!

while($row=mysql_fetch_assoc($result)){


$distance = Dist ($row['latitude'], $row['longitude'], $zip['latitude'], $zip['longitude']);
if ($distance <= $r) {
$LAT=$row['latitude'];
$LONG=$row['longitude'];
$id_contactname=$row['contact_name']; 
$CATNAME=$row['catname'];
$date = $row['date'];
$PRICE=$row['price'];
$TITLE=$row['title'];
$zipcode=$row['zipcode'];
$ITEM_NUM=$row['idnum'];
$adphoto=$row['adphotos'];

$细节= 等........

1 个答案:

答案 0 :(得分:0)

我能告诉你如何做到这一点。 下载craigslist here提供的源代码并检查它是否正常工作如果是这样,只需使用下面提到的php代码编辑它:

$result = mysql_query ($query) or trigger_error(mysql_error()." in ".$query);

while($row=mysql_fetch_assoc($result)){

    $distance = Dist ($row['latitude'], $row['longitude'], $zip['latitude'], $zip['longitude']);
    if ($distance <= $r) {
        $LAT=$row['latitude'];
        $LONG=$row['longitude'];
        $id_contactname=$row['contact_name']; 
        $CATNAME=$row['catname'];
        $date = $row['date'];
        $PRICE=$row['price'];
        $TITLE=$row['title'];
        $zipcode=$row['zipcode'];
        $ITEM_NUM=$row['idnum'];
        $adphoto=$row['adphotos'];

        echo '<li class="clearfix">';
        echo '<section class="left">';
        echo '<img src="'.$adphoto.'" alt="default thumb" class="thumb">';
        echo '<h3>Product Name</h3>';
        echo '<span class="meta">Product ID: '.$ITEM_NUM.'</span>';
        echo '</section><section class="right"><span class="price">'.$PRICE.'</span><span class="darkview"><a href="javascript:void(0);" class="firstbtn"><img src="images/read-more-btn.png" alt="Read More..."></a><a href="javascript:void(0);"><img src="images/add-to-cart-btn.png" alt="Add to Cart"></a></span></section></li>';
    }
}
$drop= "DROP table tmp_questions1";
mysql_query("$drop");