<?php
 
include 'dbconfig.php';
 
// Create connection
 
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
//$result["errorcode"]="0";
 
$sql = "SELECT * from tbl_barang";
 
$res = mysqli_query($conn, $sql);

 
$items = array();
 
if (mysqli_num_rows($res) > 0) {
 
   // while($row = mysqli_fetch_object($res)){
 
     //   array_push($items, $row);
 
//$result["errorcode"] = "1";
 
    $result["jumitem"] = mysqli_num_rows($res);
    
 
}
else
{
     $result["jumitem"] = mysqli_num_rows($res);
     $result["data"] = "failed";
 
}
 
echo json_encode($result);
 
mysqli_close($conn);
 
?>
