> --Howdy:
> 
> --Sorry, I should have added more detail in
> --my reply.  When I did the posted suggestion,
> --I only got one column, but if I ran the SQL
> --by hand, I got them all.
> 
> --But in the example below, you list out the
> --variables and then get the entire row.
> --I thought I could just pull in the
> --results of the query with one variable
> --($sql).

Nope. It returns an array so ($variable) is the first element of the array 
($variable,$variable2) is the first two elements in the array etc...

If for some bizarre reason you need to sleect several fields and then get them 
together in a string (IE one variable)

my $result = join('', $dbh->selectrow_array("..."));
But that seems pointless.

Try this:

 my @list = $dbh->selectrow_array(....);

 for(@list) { print "-$_-\n"; }


@list will have every field requested by your query
($var,$var) is an array also it just assigns the elements of the array to the 
variables listed and if there is two vars listed you get the first two elements of the 
array assigned to them. 

        At the risk of sounding sarcastic : selectrow_array will 'select' a 'row' into 
an 'array' :)

Does that make more sense now?

DMuey
> 
>  
> >>> --I think I'm well on my way, but, I'm looking
> >>> --at the results and the 'Programming the PERL DBI'
> >>> --book and it says that selectrow_array returns the
> >>> --value of the first field.
> >>
> >>It returns an array:
> >> my ($one,$two,$three) = $dbh->selectrow_array("SELECT
> >>one,two,three FROM table WHERE ID=1");
> >>Or 
> >> my @stuff = $dbh->selectrow_array("SELECT one,two,three FROM 
> >>table WHERE ID=1");
> >>
> >>It return an array for the first *row* so if it's a multirow
> >>select then you'll only get the first *row* returned.
> >>
> >>Why not simply try some of the stuff and experiment and see
> >>what happens when you do different things.
> >>
> >>> 
> >>> --selectall_arrayref and selectcol_arrayref
> >>> --doesn't seem to help.
> >>> 
> >>> --how can I return all of the fields that
> >>> --was selected?
> >>
> >>All fields into an array : selectrow_array()
> 
> --i was wondering why my other script that used
> --the prepare / execute / while ($whatever) { ...}
> --did what i wanted (but overkill for one silly row).
> --i thought the docs said that selectrow_array()
> --puts all of the 'prepare' / 'execute' in one
> --function and made the need for the extra 15
> --lines of code go away.
> 
> --you're right:  i have to continue playing with
> --it until i get the right runes.
> 
> >>All Rows you have to do the prepare execute while finish dance I 
> >>actually have a simpler way to do it I'm going to have in 
> module if I 
> >>ever hear back from the PAUSE folks. But until then that's it.
> 
> --thanks again!
> 
> [snip]
> 
> -X
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to