Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,944
    Plugin Contributions
    96

    Default Re: Fetch next row from database query

    Quote Originally Posted by DrByte View Post
    Not reliably before v155.

    Why exactly are you wanting to rewind to start?
    Really? I've been using the following construct for a couple of years now to "rewind" a previously-processed query back to the beginning:
    Code:
    $result = $db->Execute (<some sql query>);
    while (!$result->EOF) {
        ...
        $result->MoveNext ();
    }
    ...
    // -----
    // "Rewind" the query to re-process ...
    //
    $result->Move (0);
    $result->MoveNext ();
    while (!$result->EOF) {
        ...
        $result->MoveNext ();
    }

  2. #12
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Fetch next row from database query

    As suggested here, "reliability" (backwards compatibility to before ZC 1.5.5) can be obtained by testing for the method rewind as suggested by DrByte:
    Code:
    $result->Move(0);
    if (!method_exists($result, 'rewind')) {
      $result->MoveNext();
    }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v154 How to Get Count from Last Delete Query - Row Affected?
    By kwright in forum General Questions
    Replies: 3
    Last Post: 21 Feb 2016, 06:16 PM
  2. Fetch user email address from database
    By hoehnt in forum General Questions
    Replies: 6
    Last Post: 21 Dec 2009, 08:45 PM
  3. Fetch blocks of text from other URLs?
    By sjk1000 in forum General Questions
    Replies: 8
    Last Post: 3 Oct 2008, 04:05 AM
  4. ZenCart database setup error -12263 and Could not fetch schema tables
    By Xulayman in forum Installing on a Windows Server
    Replies: 4
    Last Post: 21 Aug 2007, 07:11 AM

Posting Permissions

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