Gossamer Forum
Home : General : Perl Programming :

writing to a file or template

Quote Reply
writing to a file or template
I have played with perl before but I have aways coded dirty projects that just get the job done. So forgive me if I am asking some silly questions.
My script that I am trying to write will connect to a database and pull out a list of films and then write these out to a file.
At the moment I have it just dumping to a txt file but I wanted to write out to a nicer formated html file
I want to out put to a html file but I am unsure how to do this
I am not sure if I should write the whole file in the script or to open a template and add the output to the file ?
I have to write the list of the moves to the html file and it will aways stay on line 222

I need to out put in this format
da[0]=new dataArray('10 things','movie (dvd)');
da[1]=new dataArray('2 fast 2 furious','movie (VHS)');
da[2]=new dataArray('25th hour','movie (LAZERDISK)');
Da is a of cuase the number (Sequential) 1,2,3,4 then it will need to list the name of the move and the finaly the movie type eg dvd vhs or lazerdisk.

[PHP]
#!/usr/bin/perl
use DBI;
$db_server = "localhost";
$db_user = "DBUSER";
$db_password = "PASS";
$db_database = "VIDDB";
$dbh = DBI->connect("dbi:mysql:$db_database:$db_server",$db_user,$db_password) || die("Can't connect");

$SELECT = "SELECT title, Mediatype
FROM videodata
WHERE Mediatype <> '50'
ORDER BY title";

$result = $dbh->selectall_arrayref($SELECT);
[/PHP]

Here is the code I used to do the connecting now I just need to code to output the file so if any one can give me a hand or some ideas that would be great :-)
Subject Author Views Date
Thread writing to a file or template SimonTOZ 6179 Mar 4, 2004, 4:40 PM
Thread Re: [SimonTOZ] writing to a file or template
SimonTOZ 6018 Mar 5, 2004, 4:24 AM
Thread Re: [SimonTOZ] writing to a file or template
yogi 6019 Mar 5, 2004, 4:39 AM
Thread Re: [yogi] writing to a file or template
SimonTOZ 6019 Mar 5, 2004, 6:10 AM
Post Re: [SimonTOZ] writing to a file or template
SimonTOZ 6004 Mar 7, 2004, 2:41 AM