mercredi 2 juin 2021

i need to display my products as cards in my page but nothing is showing [closed]

This is my first PHP/HTML project ever so be easy on me.

I need to display the name, price, image, and description from the database table named 'products' but nothing is coming up on my screen I don't know how to fix this I tried a lot but since I am new to PHP I couldn't understand what is going on. Any help?

This is my only error

Warning: mysqli_stmt::fetch() expects exactly 0 parameters, 1 given in C:\wamp\www\Tech Cube\shop.php on line 39

My code

<div class="row">
        <?php
            require_once "config.php";
            $select_stmt=$link->prepare("SELECT * FROM 'products'");
            $select_stmt->execute();
            while($row=$select_stmt->fetch_assoc());
            {
                ?>
                    <div class ="col-lg-4 col-md-6 mb-4">
                        <div classs="card h-100">
                            <a herf="#"><img class="card-img-top" src="uploads/<?php echo $row['image']; ?>" width="400px" height="200px"></a>
                            <div class="card-body">
                                <h4 classs="card-title text-primary"><?php echo $row['name']; ?></h4>
                                <h5><?php echo number_format($row['price'],2); ?>$<h5>
                            </div>

                            <div calss="card-footer">
                                <form class="form-submit">
                                    <input type="hidden" class="name" value="<?php echo $row['name']; ?>">
                                    <input type="hidden" class="name" value="<?php echo $row['price']; ?>">
                                    <input type="hidden" class="name" value="<?php echo $row['description']; ?>">
                                    <button id="detailes"class="btn btn-success btn-mid">Product Detailes</button>
                                </form>
                            </div>
                        </div>
                    </div>
                <?php
            }
        ?>
    </div>



Aucun commentaire:

Enregistrer un commentaire