Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to fetch data from database in php

  <?php
   //////neha jaiswal////
       include 'config.php';////incluude data base connection file
        $stmt = $conn->prepare('SELECT * FROM `product`');///select all data from database
        $stmt->execute();////query execute ($stmt)
        $result = $stmt->get_result();
        while ($row = $result->fetch_assoc()):
      ?>
         <div class="card p-2 border-secondary mb-2">
            <img src="<?= $row['product_image'] ?>" class="card-img-top" height="250">
            <div class="card-body p-1">
              <h4 class="card-title text-center text-info"><?= $row['product_name'] ?></h4>
              <h5 class="card-text text-center text-danger"><i class="fas fa-rupee-sign"></i><?= number_format($row['product_price'],2) ?>/-</h5>
Comment

php code for fetching data from database


CREATE DATABASE company;
CREATE TABLE employee(
employee_id int(10) NOT NULL AUTO_INCREMENT,
employee_name varchar(255) NOT NULL,
employee_email varchar(255) NOT NULL,
employee_contact varchar(255) NOT NULL,
employee_address varchar(255) NOT NULL,
PRIMARY KEY (employee_id)
)
Copy
Comment

PREVIOUS NEXT
Code Example
Php :: PHP Filters Advanced 
Php :: Symfony Expected argument of type "string", "null" given 
Php :: mezzio quick start templating with laminas view 
Php :: laravel debugbar not showing 
Php :: flash message laravel for incorrect password 
Php :: laravel htaccess to remove public from url 
Php :: palindrom number in php 
Php :: merge multiple exceptions php 
Php :: cookie phpsessid will be soon treated as cross-site cookie against 
Php :: /([a-z-0-9-]*) php 
Php :: php normalize whitespace characters 
Php :: $age = 20; print ($age = 18) ? "Adult" : "Not Adult"; 
Php :: htaccess rewriterule 
Php :: old codestar text field 
Php :: registerd navigations file uploadid 
Php :: https://stackoverflow.com/questions/34545641/php-artisan-makeauth-command-is-not-defined 
Php :: expiry date alert in php 
Php :: mysql php update sum same table 
Php :: PHP redirect parent page 
Php :: install php 7.4 
Php :: get my account orders page url woocommerce 
Php :: Round A Number 
Php :: enable gutenberg for template 
Php :: How can apply_filters be used to create a filter hook in wordpress 
Php :: print average result in php 
Php :: laravel {{}} not being rendered 
Php :: wordpress have same sku 
Php :: laravel eloquent where value less then 5 and greter then 0 
Php :: presentar la respuesta del conteo de la tabla una tabla en php 
Php :: phpmaker check master details page 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =