第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

數(shù)據(jù)庫中的值未出現(xiàn)在php中

數(shù)據(jù)庫中的值未出現(xiàn)在php中

元芳怎么了 2021-05-05 14:20:02
我已經(jīng)使用sql,html和php創(chuàng)建了一個購物車網(wǎng)站。購物車按鈕如下:<form method="post" action="cart.php" class="form-inline"><input type="hidden" value="' . $product['id'] . '" name="product_id"><input type="hidden" value="add_to_cart" name="add_to_cart"><button type="submit" name="id" value="12" class="btn btn-primary">Add to Cart</button></form>這是我的購物車外觀:<div class="card">        <h5 class="card-header">My Cart</h5>            <div class="card-body">                <?php                    if(isset($_SESSION['shopping_cart']) && count($_SESSION['shopping_cart']) > 0)                    {                        $entertainment = $_SESSION['shopping_cart'];                        echo '                                <table class="table table-hover table-bordered">                                <thead>                                    <tr>                                    <th scope="col">#</th>                                    <th scope="col">Title</th>                                    <th scope="col">Quantity</th>                                    <th scope="col">Price</th>                                    <th scope="col" width="100">Action</th>                                    </tr>                                </thead>';                        $item_number = 1;                        $total = 0;                        foreach ($entertainment as $product) {                        echo '                                <tbody>                                    <tr>                                    <th scope="row">'. $item_number .'</th>                                    <td>' . $product['title'] . '</td>                                    <td>'.$product['quantity'].'</td>                                    <td>$ '. $product['offer_price_corporate_artist']. '</td>                                    <td>問題是,當我向購物車中添加商品時,我可以顯示標題和購物車。但是我無法顯示價格,該價格的字段名稱在我的數(shù)據(jù)庫中為offer_price_corporate_artist。誰能告訴我我所缺少的。
查看完整描述

1 回答

?
開滿天機

TA貢獻1786條經(jīng)驗 獲得超13個贊

您的購物車模型將offer_price_corporate_artist列放入返回的數(shù)組中,稱為重命名事件price

$data['price'] = $row['offer_price_corporate_artist'];

因此,在其他腳本中替換

<td>$ '. $product['offer_price_corporate_artist']. '</td>

<td>$ '. $product['price']. '</td>

小警告

不幸的是,該getProducts()方法未將列重命名為,price因此您會有一些異常,這會在某處給您帶來問題


查看完整回答
反對 回復 2021-05-20
  • 1 回答
  • 0 關注
  • 129 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號