$products = $db->query("SELECT name, pricerub FROM products");
$product = [];
while ($row = $products->fetch_array()) {
$product[] = [
'name' => $row['name'],
'pricerub' => $row['pricerub']
];
}
$bot->sendMessage($chat_id,
'Товары:
'.implode("\n", $product['name']).'('.implode("\n", $product['pricerub']).')'.
'
Введите стоимость товара который хотите купить');
$products = $db->query("SELECT name, description, pricerub, priceusd FROM products");
$product = '';
while ($row = $products->fetch_array()) {
$product .= $row['name']." (".$row['description'].") — ".$row['pricerub']."₽"." (".$row['priceusd']."$)\n";
}
$bot->sendMessage($chat_id,
'Товары:
'.$product.
'
Введите стоимость товара который хотите купить');