in reply to Re: Images
in thread Images

Hi, Thanks for your kind response. I've changed my code.but still ....can't get it. my new code is aas follows...
#!/usr/bin/perl use strict; use DBI; my ($user,$password,$sno,$name,$datasource,$h); $user="mydb1"; $password="mydb1"; print "Content-type:text/html\n\n"; my $h = qq{<html><body>}; my $dbh = DBI->connect("dbi:mysql:mydb", $user, $password) or die "Can +'t connect to "; my $sth = $dbh->prepare( q{SELECT sno, name FROM IMAGE}) or die "Can't + prepare statement: $DBI::errstr"; my $rc = $sth->execute or die "Can't execute statement: $DBI::errstr +"; while ( my($sno, $name) = $sth->fetchrow() ) { $h .= qq{$name}; } $sth->finish; print $h; print "</body></html>\n"; $dbh->disconnect;
The images are not appearing .

Edit kudra, 2002-10-27 Added code tags

Replies are listed 'Best First'.
Re: Images
by donniejones18 (Initiate) on Oct 25, 2002 at 14:22 UTC
    #!/usr/bin/perl use strict; use DBI; my ($user,$password,$sno,$name,$datasource,$h); $user="mydb1"; $password="mydb1"; print "Content-type:text/html\n\n"; my $h = qq{<html><body>}; my $dbh = DBI->connect("dbi:mysql:mydb", $user, $password) or die "Can +'t connect to "; my $sth = $dbh->prepare( q{SELECT sno, name FROM IMAGE}) or die "Can't + prepare statement: $DBI::errstr"; my $rc = $sth->execute or die "Can't execute statement: $DBI::errstr"; + while ( my($sno, $name) = $sth->fetchrow() ) { $h .= qq{$name}; } $sth->finish; print $h; print "</body></html>\n"; $dbh->disconnect;
    The $name part should be more like this:
    $h .= qq{<img src="$name" width="300" height="300">};
    The print $h part is displaying the data in $h, but this data must be in html format, meaning that you need html code for the images to show up. Good luck! donniejones18

    Edit kudra, 2002-10-27 Added line breaks within code