> Hi All
Howdy
>
> I my query a MySQL database and have the following code
>
> while (@temp = $table->fetchrow_array ()) {
> some code
> {
I think you mean } not { :)
>
> my problem is that I want the results from the database query
> to be access by using $temp[0] for the first row then
> $temp[1] for the second row and so on.
Sure is and you've already got that:
while (@temp = $table->fetchrow_array ()) {
print "$temp[0] $temp[1] $temp[2] $temp[4]";
# or whatever
}
Outside of the while loop you'll only have one version of @temp if any, so if you need
to
use $temp[n] outside the while loop you'll need to assignthe values to an outside
variable
Perhaps a hash.
If there's only going to be one record returned you can just do:
my @temp = $table->fetchrow_array($query);
And skip the prepare and execute stuff. Then you could use
$temp[n] wherever your @temp was declared
>
> So is it possable to do this and if so how or where can I
> find the info.
>
perldoc DBI
HTH
DMuey
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]