Answers for "fetch data from php to js"

PHP
1

fetch body show in php code

$entityBody = file_get_contents('php://input');
Posted by: Guest on June-27-2020
2

fetch value from json link in php

$ch = curl_init();
// IMPORTANT: the below line is a security risk, read https://paragonie.com/blog/2017/10/certainty-automated-cacert-pem-management-for-php-software
// in most cases, you should set it to true
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'url_here');
$result = curl_exec($ch);
curl_close($ch);

$obj = json_decode($result);
echo $obj->access_token;
Posted by: Guest on June-17-2020
-2

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>
Posted by: Guest on January-16-2021

Browse Popular Code Answers by Language