in reply to Re^2: Direct to spreadsheet
in thread Direct to spreadsheet
The @sql is used because a sql string which consists of many parts including a "select * from" is built further up the code.
Okay, but it still doesn't make sense. $sth->prepare accepts just a single parameter (an SQL statement string). So as far as I can see, the only way your code can possibly work is if you are passing a single element list. In which case, you should be assigning your SQL string to a scalar variable (ie. $sql).
However, that doesn't really address your current problem. If reading your entire result set into a hashref isn't an option, then you probably want a LoL
In any case, your current use of selectall_arrayref fetchrow_arrayref is un-necessary. You could simply do something like:
...and then the linewhile (@row = $sth->fetchrow_array) {
..simply becomesprint TXT "\nBOR $data->[3]|$data->[2]|$data->[9]|$data->[10]|$data-> +[4]|$data->[13]";
..or as GrandFather suggestedprint TXT "\nBOR ", join("|", @data[3,2,9,10,4,13]);
push @data, "\nBOR ", join("|", @data[3,2,9,10,4,13]);
Apologies if I'm not appearing very helpful. But as I said earlier, I'm finding it difficult to visualise the solution without actually seeing what your data looks like. Perhaps some more experienced monk will chip in and offer their advice :)
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Direct to spreadsheet
by Anonymous Monk on Jan 23, 2006 at 16:03 UTC | |
by McDarren (Abbot) on Jan 23, 2006 at 17:22 UTC |