CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced: Re: [kwatts59] Problem with fetchrow_array: Edit Log

Veteran / Moderator

Jun 24, 2017, 7:15 AM

Views: 30901
Re: [kwatts59] Problem with fetchrow_array

Why are you fetching the row inside the body of the loop? Doing That is the cause of your problem.

The fetch statement (@row assignment) should be in the while loop initialization.

Why are you fetching 2 fields but only ever use the first?

You should enable RaiseError in the connection statement and not worry about using the die statement on the prepare, execute and fetch statements. If you must, you could use eval as Bill suggested to trap the errors.

$gene_symbols[$i] = $row[0];

Is better written as:

push @gene_symbols, $row[0];

(This post was edited by FishMonger on Jun 24, 2017, 7:18 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Jun 24, 2017, 7:18 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives