Perl & MySQL question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: JonathanFurrerjonny@jofu.com
Date:  
Subject: Perl & MySQL question
ok *smile* I was just working on something kind of similar. using your
code, in that that while loop add two lines that add the current
$data->{'col1'} to its array and $data->{'col2'} to its array. I think
thats what your question was, correct? And then at the end you just make
an array of array1 and array2. That answer seems to simple to me, so its
possibiliy not what you're looking for :-) I just started to use perl with
MySQL, before that I would ALWAYS use php, but then it got down to where I
needed to do some CLI stuff, and so..it happened :-). Which is fine
anyways, cause I was always more comfty with perl.

_______________
Jonathan Furrer

Be sure to check out my NEW site...
http://www.jofu.com/

On Sun, 9 Jul 2000, Mike Starke wrote:

> I have something like the following in a script:
>
> $sql = qq{SELECT col1, col2 FROM table};
> $sth = $dbh->prepare($sql);
> $sth->execute;
> while (my $data = $sth->fetchrow_hashref) {
>    do stuff
> }
> another while loop

>
> I need to take the values from the query and create
> two arrays: @array1 = values in col1, @array2 = values in col2
> after this, I then create a third array
> @array3 = ([@array1], [@array2]);
>
> I have been brute forcing this by making two calls,
> one while loop for col1, and then turn around and another
> while loop for col2. I know the Perl way is there is more than one
> way to do things, but certainlly there is a better way.
> As you can see by the question, I am no Perl expert, but
> anyone willing to lend a hand?
>
> Mike
>
> http://www.getnet.com/~mgcon
> Phoenix, AZ
> USA
>
>
> _______________________________________________
> Plug-discuss mailing list -
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>