Hi,
I have a problem with my output from my script after the script has executed, my output is in a long string, the data is correct but the format is incorrect.
Could someone show me how to format my output into a more readable format please? in a table or something.
The script takes input from a form and runs a query against a database of cars, the values applicable to the query (the results) are then output.
The values are all registration numbers and colours of cars which match the make and model chosen in the form.
At the moment my output looks like this:
What I want is something like this :Code:BlackRedYellowGreenGreenWhiteBlueBlue GA53EVZKK50ZBKNV51KYURH50EEQTZ50STLVO50OZYXY50BMNYC51KYY
Here is my script:Code:GA53EVZ Black KK50ZBK Red etc
Code:#!/www/perl/bin/perl use CGI; use DBI; use diagnostics; use warnings; use CGI::Carp qw(fatalsToBrowser); $CGI::POST_MAX = 128; $CGI::DISABLE_UPLOADS = 1; $model=CGI::param("model"); $make=CGI::param("make"); #connect to database giving pass and username if (!($dbh = DBI->connect("DBI:mysql:dbname:localhost", 'uname', 'passwd'))) { &outputErr("couldn't connect to database".DBI->errstr); } if (!($query = $dbh->prepare("SELECT registration, colour FROM car WHERE make = '$make' AND model = '$model' "))) { &outputErr("couldn't prepare statement".$dbh->errstr); } #execute the query if (!($query->execute())) { &outputErr("couldn't execute statement".$query->errstr); } while (@car = $query->fetchrow_array()) { print $registration.=$car[0]; print $colour.=$car[1]; } $query->finish; $dbh->disconnect; print <<PAGE; Content-type: text/html \n\n <html> <head> <title>Details</title> </head> <body bgcolor="#E7E7E7"> <table border="1"> <tr> <td> $colour </td> </tr> <tr> <td> $registration </td> </tr> </table> </body> </html> PAGE exit 0;


LinkBack URL
About LinkBacks



Reply With Quote
Hope this helps.

Bookmarks