Results 1 to 2 of 2

Thread: Move to first record after loop

  1. #1

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Resolved Move to first record after loop

    I do a query, and loop through the result and build a select list from it.

    Thing is I wan to use this result over and over so just want to get it once, then do a "while($row = $results->fetch_object()) " several times.

    But seems after you did it once you cant loop through the results again.

    Remember sth in .net and vb6 like recordset.movefirst....is there and equivalent in php / mysqli ?
    Last edited by StrangerInBeijing; Jun 25th, 2008 at 09:08 PM.
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  2. #2
    Addicted Member
    Join Date
    Feb 2006
    Location
    Hyderabad, India
    Posts
    233

    Re: Move to first record after loop

    $results->data_seek(0); before the next loop.

Posting Permissions

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



Click Here to Expand Forum to Full Width