I work with medoo library. Tell me how to get the value of price, where itemId = $ itemId?

$db_site = $this->Connect(self::$_conf['icon_db']); $price = $db_site->get("shop", "price", "itemId" => $itemId); 

    2 answers 2

     $db_site->get("shop", "price", [ "itemId" => $itemId ]); 

    In medoo, you need to pass an array with conditions

    • so I tried, gives an error - syntax error, unexpected '[' - Elizaveta
    • @ Elizabeth what version of php? may need array ("itemId" => $ itemId) instead of [..] - Stanislav Grot
    • array ("itemId" => $ itemId) in this case returns "Array" - Elizaveta
    • @ Is Elizabeth the result of the get function? get should return a string if its second string parameter is Stanislav Grot
    • $ price = $ db_site-> select ("shop", "price", array ("itemId" => $ itemId)); - $ itemId = $ _GET ['itemId']; (any number) - Elizabeth

    decided so:

     $price = $db_site->select('shop','*' ,array('itemId'=>$itemId)); if($price !== false and count($price) > 0 and $price[0]['price'] != ''){ echo $price[0]['price']; }