# Лучше всего так $type = [ 'ruby' => 'Рубины', 'sapphire' => 'Сапфиры', 'emeralds' => 'Изумруды' ]; $select = $type[array_rand($type)]; DB::getInstance() -> query('UPDATE `users` SET `'.$select.'` = `'.$select.'` + '.rand(1,3).' WHERE `id` ='.$u['id']);
<?php $type = ['ruby' => 'рубины', 'sapphire' => 'сапфиры', 'emeralds' => 'изумруды']; $select = array_rand($type); $ru = $type[$select]; echo $ru; DB::getInstance()->query('UPDATE `users` SET `'.$select.'` = `'.$select.'` + '.rand(1,3).' WHERE `id` ='.$u['id']);