> > > Hi , I want to display database records as web page my database > contains some entries and which i wanna write as a report in web > page. > > I have written a code for it which fetches the data from database > which i wil show u below: my requirement is to align each fields and > dispaly them as a report . > > #!/usr/bin/perl -w > use DBI; > > #use CGI qw(:standard); > #use CGI::Carp qw(fatalsToBrowser carpout); > print("Content-type: text/html\n\n"); > > > my $dbh = open_dbi(); > > my $sth2 = $dbh->prepare( q{ SELECT * From longdescs } ) > > or die "Can't execute statement $DBI::errstr"; > > $sth2->execute(); > print "\nContent of Database is \n\n"; > > print " bug_id\t who\t bug_when\t work_time\t > thetext\t isprivate\t already_wrapped\n"; > > > my( $bug_id, $who, $bug_when, $work_time, $thetext, > $isprivate, $already_wrapped ); > $sth2->bind_columns( undef, \$bug_id, \$who, > \$bug_when, \$work_time, \$thetext, \$isprivate, \$already_wrapped > ); > > > while( $sth2->fetch() ) > { > > > print "$bug_id\t, $who\t, $bug_when\t, $work_time\t $thetext\t > $isprivate\t $already_wrapped\t \n"; > } > > $sth2->finish(); > > > > print"\n"; > > $dbh->disconnect; > > > sub open_dbi > { > # Declare server variables > my $host = 'localhost'; > my $db = 'xyz'; > my $db_user = 'madhu'; > my $db_password = 'madhan'; > > # Connect to the server > > my $dbh_local = DBI->connect("dbi:mysql:$db:$host", "$db_user", > "$db_password", > {RaiseError => 0, PrintError => 0} ) > > or err_trap("Cannot connect to the database"); > > #print "DB Established\n"; > return $dbh_local; > } > > > > when i run this script on apache web server it messes up all data and > displays like this which doesn't give a clear picture of what is > what. > > > Content of Database is bug_id who bug_when work_time thetext isprivate > already_wrapped 6 , 4 , 2006-02-23 10:35:09 , 0.00 Test > !!!!!!!!!!!!!!!!! 0 0 7 , 6 , 2006-02-23 10:52:50 , 0.00 Test for 0 0 > 5 , 4 , 2006-02-21 17:02:13 , 0.00 Hi this is a test !!!!!!!!!!! 0 0 5 > , 4 , 2006-02-21 17:11:37 , 0.00 (In reply to comment #0) > Hi this is > a test !!!!!!!!!!! Ok !!!! Bug fixed 0 0 2 , 1 , 2006-02-07 11:28:57 , > 0.00 Hi the scripts are ready. 0 0 8 , 6 , 2006-02-23 11:07:32 , 0.00 > Hi testing the !!!!!!!!!!!!! 0 0 1 , 5 , 2006-03-02 15:01:59 , 0.00 > The bug has been fixed so changing the status plz Affected files: > --------------- 1.2 --> 1.3 1.2,1.3,xyz/readme.txt 0 0 9 , 6 , > 2006-03-02 15:21:27 , 0.00 scmbug test is working !!!!!!! 0 0 9 , 6 , > 2006-03-02 15:22:25 , 0.00 > > i want the code to display records like a clear report with individual > fileds having spaces in between them, i hav been fighting with the > code for longtime . > > Can u plz help me out !!!!!!!!!! > > Thanks in advance > > Regards > > Madhan. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > Hi there!
Seems to me it is something do to with the newline \n - statement Some operatingsystems do need \r\n instead of only \n Best regards /Gustav Wiberg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>