this goes to the perl dbi mailing list...
anyway, *fetchall_arrayref* in your script will (probably) return
a list of list (a two dimensional array).
and the snippet below is for how you will simply display it.
see `perldoc perldsc` for explanation of perl data structures.
foreach $i ( 0..$#{ $dat } ) {
foreach $j ( 0..$#{ $dat->[$i] } ) {
print $dat->[$i][$j];
}
}
if there exist no data after this, maybe there is really no data to
fetch or maybe there is but null or empty.
to check if there really exist data...
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = blah blah blah;
my $sth = $dbh->prepare(q{SELECT COUNT(*) FROM table__name}) or die
$DBI::errstr;
$sth->execute or die $DBI::errstr;
my $dat = $sth->fetchrow_arrayref;
print "Row count is: $dat->[0]\n";
[EMAIL PROTECTED] writes:
>this is not work !
>what mean is "(0..$#{$dat})".
>
>
>
>�� 00-11-22 ���� 10:57:00 �����
>>try this. I haven't tested it (but i think this will work).
>>
>>$dat = $sth -> fetchall_arrayref;
>>foreach $i ( 0..$#{ $dat } ) {
>> foreach $j ( 0..$#{ $dat->[$i] } ) {
>> print $dat->[$i][$j];
>> }
>>}
>>
>>see `perldoc perldsc`
>>
>>sherwin
>>
>>[EMAIL PROTECTED] writes:
>>># but here....
>>>for($i=0;$i<10;$i++){ # but here i did not see the first value ..
>>>$dat = $sth -> fetchall_arrayref;
>>>for($j=0;$j<10;$j++){
>>>print "$dat->[$i][$j]";
>>>}
>>>}
>
> ��
>��
>
> lyf
> [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
EMC
Technical Support
http://www.emc.com.ph/
http://mnl.emc.com.ph/
[EMAIL PROTECTED]
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~
Voice: 6312909 / 6354152 / 6354139
6384482 (techsupport) /
6384483 (customersupport)
Fax: 6327319
~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]