Results 1 to 4 of 4
  1. #1
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    Perl Looping Question
    Need some help again.
    Have a script in perl that looks like this:

    my $sql = $dbh->prepare('select query from TABLE A here');
    $sql->execute();
    while(my @row = $sql->fetchrow_array()) {
    ...
    process data
    ...
    }

    Here's the pickle.
    I run the script and the data processing works at every stage on all the data retrieved. Problem is, it seems not all the rows are being passed into the while loop. Once I run the script a large chunk of data gets processed. If I run it again no rows should be affected. Problem is, I can run it again and again and each time 1 row will be found and processed. (once a row is processed it is removed from Table A so it's not a matter of data being repeatedly processed. It's always a new row that should have been done the first time as all rows should be done the first time)
    It's like my while loop is only selecting one row and stopping. Every tutorial I have found on this shows I should be doing this as above to get all the rows. I am a bit confused.
    Started Perl on Monday so I apologize if I missed something simple/stupid.
    Thanks for any help you can offer.
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  2. #2
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    Started getting weird results from other tables as well.
    Restored the MySQL db and now everything seems to work.

    edited to add ... I think
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  3. #3
    ABW Ambassador Snib's Avatar
    Join Date
    January 18th, 2005
    Location
    Virginia
    Posts
    5,303
    Your tables may have gone bad. Always good to try mysqlcheck to see if there are any errors.

    - Scott
    Hatred stirs up strife, But love covers all transgressions.

  4. #4
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    thank you Scott
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Perl Help...
    By eggerda in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: July 22nd, 2003, 05:40 AM
  2. Perl help.
    By mewmew in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: October 10th, 2002, 03:41 PM

Posting Permissions

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