Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="%s"/ Название : "%s"/ Цена : "%s"/ Груперованно : "$s"].'; const RETURN_ONE = '"Shop.capitalcity": Возврат из комиссионного магазина предмет: [id="%s"/ Название : "%s"/ Цена : "%s"].'; const SHOP_TYPE = 'Shop.comission'; setlocale(LC_CTYPE, "ru_RU.CP1251"); include('/home/newcom1/public_html/_incl_data/__config.php'); include('/home/newcom1/public_html/_incl_data/class/__db_connect.php'); $u = User::start(); $q = 'select items_main.id, uid, inGroup, item_id, price1, name from items_users left join items_main on items_main.id = item_id where inShop = 30 and `delete` = 0'; foreach ($pdo->query($q) as $row) { if ($row['inGroup']) { $col = $u->itemsX($row['id']); if ($col > 1) { $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where item_id = ? and inShop = 30 and uid = ? and inGroup = ? limit ' . $col); if ($stmt->execute([$row['price1'], $row['item_id'], $row['uid'], $row['inGroup']])) { $ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_GROUP, $row['item_id'], $row['name'], $row['price1'], $row['inGroup'] . '+1'), time(), $u->info['city'], SHOP_TYPE, 0, 0); } } else { $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where uid = ? and id = ? and inOdet = 0 and `delete` = 0 and inShop = 30'); if ($stmt->execute([$row['price1'], $row['uid'], $row['id']])) { $ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']), time(), $u->info['city'], SHOP_TYPE, 0, 0); } } } else { $stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30'); if ($stmt->execute([$row['price1'], $row['id']])) { $ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']), time(), $u->info['city'], SHOP_TYPE, 0, 0); } } }