You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
537 B

<?php
namespace Etu\Helpers;
use PDO;
class Inventory
{
/** @var PDO */
private $db;
public function __construct(PDO $db)
{
$this->db = $db;
}
public function get(string $name) : ?\stdClass
{
// Prepare query
$stmt = $this->db->prepare('SELECT * FROM inventory WHERE item_name = :item_name');
// Bind value
$stmt->bindValue('item_name', $name, PDO::PARAM_STR);
// Execute and fetch result
$stmt->execute();
return $stmt->fetch();
}
}