PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE IF NOT EXISTS product ( product_id int(11) NOT NULL, product_name varchar(100) NOT NULL, product_price varchar(50) NOT NULL, product_image varchar(255) NOT NULL, product_code varchar(10) NOT NULL ); INSERT INTO product (product_id, product_name, product_price, product_image, product_code) VALUES (1, 'laptop', '200', 'laptop.jpg', 'p1000');
Copy Clear
Copy Format Clear
<?php //require_once "dbconfig.php"; $db = &$pdo; $select_stmt=$db->prepare("SELECT * FROM product"); $select_stmt->execute(); while($row=$select_stmt->fetch(PDO::FETCH_ASSOC)) { ?> <div class="col-lg-4 col-md-6 mb-4"> <div class="card h-100"> <a href="#"><img class="card-img-top" src="images/<?php echo $row['product_image']; ?>"</a> <div class="card-body"> <h4 class="card-title text-primary"><?php echo $row['product_name']; ?> </h4> <h5><?php echo number_format($row['product_price'],2); ?>/-</h5> </div> <div class="card-footer"> <form class="form-submit"> <input type="hidden" class="pid" value="<?php echo $row['product_id']; ?>"> <input type="hidden" class="pname" value="<?php echo $row['product_name']; ?>"> <input type="hidden" class="pprice" value="<?php echo $row['product_price']; ?>"> <input type="hidden" class="pimage" value="<?php echo $row['product_image']; ?>"> <input type="hidden" class="pcode" value="<?php echo $row['product_code']; ?>"> <button id="addItem" class="btn btn-success btn-md">Add to Cart</button> </form> </div> };
Show:  
Copy Clear