"" ORDER BY RANDOM() LIMIT 10' ); for ( $i=0; $i < count( $rndTovar ); $i++ ) { $rndTovar[$i]['cena'] = \DB::getValue( "SELECT `cena` FROM `tovar_price_history` WHERE `tovar_id`=? ORDER BY `t` DESC LIMIT 1", $rndTovar[$i]['id'] ); $rndTovar[$i]['img'] = \DB::getValue( "SELECT `filename` FROM `tovar_img` WHERE `tovar_id`=? LIMIT 1", $rndTovar[$i]['id'] ); } $smarty -> assign( 'rndTovar', $rndTovar ); ?>