Results 1 to 2 of 2

Thread: retrieving data into a two-dimensional array

Hybrid View

  1. #1
    Join Date
    Oct 2009

    Question retrieving data into a two-dimensional array

    I want to retrieve my data into a two-dimensional array that I can navigate through with a foreach loop, and be able to add new fields to the array afterwords.

    For example
    foreach($query_results as $qr)
         $qr->brand_new_field = retrieve_other_data($qr->first_field, $qr->second_field);
    I`m going around in circles with this but I can`t quite seem to get it right. Any suggestions?

  2. #2
    Join Date
    May 2003
    Do you mean from a MySQL "SELECT" query result, you want in a 2-dim array?

    Try THIS. It will convert a select result to a 2 dimensional array automatically.

    aternatively you could extract the qry result using mysql_fetch_assoc() to get the result into an array.
    We do precision guesswork

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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