用php创建一个带有bootstrap和mysql的滑动小部件

时间:2015-06-09 18:13:44

标签: php mysql twitter-bootstrap

我正在尝试创建一个滑动小部件,一个带有引导程序的滑动小部件和带有PHP的MySQL。在小部件上,我只能在数据库中显示8个中的一个(第一个)记录。

有什么方法可以解决这个问题吗?

<div class="widget widget-default widget-carousel">
    <div class="owl-carousel" id="owl-example">
        <div>
            <?php
            $query = "SELECT wlt_name as wltname,max(DATE_FORMAT(wlt_txn_date,'%d-%b-%Y')) as lastdate, truncate (sum(IF(wlt_txn_type = 'Expense', -wlt_txn_amount, wlt_txn_amount)),2) AS netamount from wallet_txns WHERE  wlt_txn_id > 0 and wlt_holder_id = 1 group by wlt_name limit 10";
            $res = mysqli_query($bd, $query);
            $count = mysqli_num_rows($res);
            $slides = '';
            $counter = 0;
            while ($row = mysqli_fetch_array($res))
            {
                $title = $row['wltname'];
                $desc = $row['lastdate'];
                $image = $row['netamount'];
                if ($counter == 0) 
                {
                    $slides .= '
                        <h3>' . $title . '</h3>
                        <p>' . $desc . '.</p>  
                        <p>' . $image . '.</p>';
                }
                    $counter++;
            }
            ?>
        </div>                               
        <div class="widget-subtitle"> <?php echo $slides; ?></div>
    </div>                            
    <div class="widget-controls">                                
        <a href="#" class="widget-control-right widget-remove" data-toggle="tooltip" data-placement="top" title="Remove Widget"><span class="fa fa-times"></span></a>
    </div>                             
</div>

0 个答案:

没有答案