in reply to Re: DBD::SQLite
in thread Error querying DBD::SQLite
There is a missing $sth->execute() though, as someone else already identified. After you prepare the query, you have to execute it before $sth->fetchrow_array() begins populating.
The code has one other potential problem which is unrelated to the error message. That is that $sth->fetchrow_array() fetches one row each time you invoke it. But the query prepared is asking for the column named "1" from all rows of "dual". That means that unless the database has only one row, you're doing a lot of work just to throw everything away except for the first row fetched. The more common idiom is:
while ( my @row = $sth->fetchrow_array() ) { # process the row of data }
HTH
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: DBD::SQLite
by perrin (Chancellor) on Apr 13, 2004 at 04:16 UTC | |
|
Re: Re: Re: DBD::SQLite
by Mr. Muskrat (Canon) on Apr 13, 2004 at 04:34 UTC | |
by liz (Monsignor) on Apr 13, 2004 at 07:53 UTC | |
by castaway (Parson) on Apr 13, 2004 at 08:35 UTC | |
by davido (Cardinal) on Apr 13, 2004 at 05:08 UTC |