Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

arrays - php select X items from set? -


i using code igniter retrieve data database

what returned array objects

something like

array(   [0] = {     mobile => '027xxxxxx',     id     => 1   },   [1] = {     mobile => '027xxxxxx',     id     => 4   },   [2] = {     mobile => '027xxxxxx',     id     => 5   },   [3] = {     mobile => '027xxxxxx',     id     => 7   },   [4] = {     mobile => '027xxxxxx',     id     => 9   },   [5] = {     mobile => '027xxxxxx',     id     => 10   },   [6] = {     mobile => '027xxxxxx',     id     => 112   },   [7] = {     mobile => '027xxxxxx',     id     => 113   } ) 

i have variable called count, contains arbitrary number (although less number of objects in array).

my question is:

say count = 3, how array of 3 random id's object?

something array(4, 9, 1)

i want single id once

so array(4, 4, 9) incorrect.

note id's not linear.

$random_keys = array_rand(array_keys($your_array), 3); 

array_rand

explain -

  • array_keys return key original array
  • array_rand pick randomly without repeatability
  • and return of array contains key original array
  • so can retrieve information original array

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -