无法将数据库内容显示到指定的字段中

时间:2018-04-19 16:50:04

标签: php mysql

我正在尝试创建电子商务网站。它既没有显示错误也没有提供编码结果。尝试开发弹出窗口模式它没有显示结果,模态弹出窗口出现但是回放代码被放置以检索数据库表值,例如此命令不起作用。如何找到错误?

<!-- The Modal -->
<?php
require_once '../core/init.php';
<!--this code is to retreive data from database thelewala and table products-->
$id = $_post['id'];
$id = (int)$id;
$sql = "SELECT * FROM products WHERE id = '$id'";
$result = $db->query($sql);
$product = mysqli_fetch_assoc($result);

<!-- this code is to retrieve data from database thelewala and table brand-->
$brand_id = $product['brand'];
$sql = "SELECT brand FROM brand WHERE id = '$brand_id'";
$brand_query = $db->query($sql);
$brand = mysqli_fetch_assoc($brand_query);

?>
<?php ob_start(); ?>
        <div class="modal fade" id="details-modal">
          <div class="modal-dialog">
            <div class="modal-content">

              <!-- Modal Header -->
              <div class="modal-header">
                <h4 class="modal-title"><?php echo $product['title']; ?></h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
              </div>

              <!-- Modal body -->
              <div class="modal-body">
                <div class="container-fluid">
                  <div class="row">
                    <div class="col-sm-6">
                      <div>
                        <img src="<?php echo $product['image']; ?>" alt="<?php echo $product['title']; ?>'" class="details img.responsive" />
                      </div>
                    </div>
                      <div class="col-sm-6">
                        <h4>Details</h4>
                        <p><?php echo $product['discription']; ?></p>
                        <hr />
                        <p>Price : Rs. <?php echo $product['price']; ?></p>
                        <p>Brand : <?php echo $brand['brand']; ?></p>
                        <form action="add_card.php" method="post">
                        <div class="form-group">
                          <div class="col-xs-3">
                            <lable for="quantity">Quantity</lable>
                            <input type="text" class="form-control" id="quantity" name="quantity" />
                          </div>
                        </div>
                        <div class="form-group">
                          <lable for="size">Size</lable>
                          <select name="size" id="size" class="form-control">
                          <option value=""></option>
                          <option value="32">32</option>
                          <option value="36">36</option>
                          <option value="XL">XL</option>
                        </select>
                        </div>
                        </form>
                      </div>

                  </div>
                </div>
              </div>

              <!-- Modal footer -->
              <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-warning" <span class="glyphicon glyphicon-shopping-cart"></spa>Add to Cart</button>
              </div>

            </div>
          </div>
        </div>
<?php echo ob_get_clean(); ?>

0 个答案:

没有答案