F
froil
I am looking for the best way to limit the results to the first 10 that
are recieved from the database. Below is the code i know that i need
to add a counter i am just wondering where the best most effective way
to use it would be. can you pass two arguements in a while loop?
thanks in advance.
#!/usr/bin/perl -wT
use strict;
use DBI;
use CGI qwstandard);
use CGI::Carp qw(fatalsToBrowser);
my $Url_Path = "/journalpics";
my $username = '?';
my $password = '?';
my $data_source = 'DBI:mysql:jilesfr_pictures:69.6.255.192:3306';
Print_Html_Top();
Get_Descriptions();
Print_Html_Bottom();
sub Print_Row{
my $rec = shift;
my $Picture = $rec->{Picture};
my $User = $rec->{User};
my $Blog = $rec->{Blog};
my $Date = $rec->{Date};
print qq(<tr><td><p align=center><img
src=$Url_Path/$Picture></p></td></tr>);
print qq(<tr><td><P align=center><FONT
size=5>$Date</FONT></P></td></tr>);
print qq(<tr><td><P align=center><FONT size=3>posted by:
$User</FONT></P></td></tr>);
print qq(<tr><td><P align=center><Font
size=4>$Blog</font></p></td></tr>);
print qq(<tr height=10><td></td></tr>);
}
sub Get_Descriptions{
my $DBH = DBI->connect( $data_source, $username, $password )
or die "Error: $DBI::errstr\n";
my $sth_fetch =
$DBH->prepare( qq(SELECT * FROM Blog) ) or die
$DBH->errstr;
$sth_fetch->execute();
while( my $ptr = $sth_fetch->fetchrow_hashref ){
Print_Row($ptr);
}
}
sub Print_Html_Top {
print header;
print start_html("JilesFamily.net");
print qq(<table border=1>);
}
sub Print_Html_Bottom{
print qq(</table>);
print end_html;
}
are recieved from the database. Below is the code i know that i need
to add a counter i am just wondering where the best most effective way
to use it would be. can you pass two arguements in a while loop?
thanks in advance.
#!/usr/bin/perl -wT
use strict;
use DBI;
use CGI qwstandard);
use CGI::Carp qw(fatalsToBrowser);
my $Url_Path = "/journalpics";
my $username = '?';
my $password = '?';
my $data_source = 'DBI:mysql:jilesfr_pictures:69.6.255.192:3306';
Print_Html_Top();
Get_Descriptions();
Print_Html_Bottom();
sub Print_Row{
my $rec = shift;
my $Picture = $rec->{Picture};
my $User = $rec->{User};
my $Blog = $rec->{Blog};
my $Date = $rec->{Date};
print qq(<tr><td><p align=center><img
src=$Url_Path/$Picture></p></td></tr>);
print qq(<tr><td><P align=center><FONT
size=5>$Date</FONT></P></td></tr>);
print qq(<tr><td><P align=center><FONT size=3>posted by:
$User</FONT></P></td></tr>);
print qq(<tr><td><P align=center><Font
size=4>$Blog</font></p></td></tr>);
print qq(<tr height=10><td></td></tr>);
}
sub Get_Descriptions{
my $DBH = DBI->connect( $data_source, $username, $password )
or die "Error: $DBI::errstr\n";
my $sth_fetch =
$DBH->prepare( qq(SELECT * FROM Blog) ) or die
$DBH->errstr;
$sth_fetch->execute();
while( my $ptr = $sth_fetch->fetchrow_hashref ){
Print_Row($ptr);
}
}
sub Print_Html_Top {
print header;
print start_html("JilesFamily.net");
print qq(<table border=1>);
}
sub Print_Html_Bottom{
print qq(</table>);
print end_html;
}