SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2004
    Location
    Fort Lauderdale
    Posts
    522
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random value from array question

    I have this code...what I need should be pretty simple:
    PHP Code:
    $trainerInfo[$row] = array(
                                        
    'id'                     =>     $recordSet[0],
                                        
    'firstname'                =>    $recordSet[1],
                                        
    'middlename'                =>    $recordSet[2],
                                        
    'lastname'                =>    $recordSet[3],
                                        
    'city'                    =>    $recordSet[4],
                                        
    'state'                     =>    $recordSet[5],
                                        
    'experience'                 =>  $recordSet[6] ,
                                        
    'yearsofexperience'            => $recordSet[7],
                                        
    'certifications'                 => $certificationArray,
                                        
    'pictureLink'                 => $picPath
                                        
    ); 
    I need to first randomly extract two Rows from the array based on Ids.
    Then I should delete all rows that do not have the previously selected ids.

    Please help
    Paul
    Last edited by photo312; May 23, 2004 at 23:51.

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2004
    Location
    Fort Lauderdale
    Posts
    522
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any array gurus?

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pick a random element out of an array: array_rand
    delete array element: unset

  4. #4
    SitePoint Evangelist
    Join Date
    Mar 2004
    Location
    Fort Lauderdale
    Posts
    522
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried array_rand - its not working.

    See - I have array of arrays....

    $trainerInfo[$row] is an array in itself.

    can you give me the exact code?
    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •