next up previous contents index
Next: PHP Up: DBI/DBD Previous: DBI/DBD   Índice General   Índice de Materias

Ejemplo de DBI/DBD

    $dbname = 'mitabla';
    $host = 'miservidor.com';
    $options = '-B 2048';
    $username = 'lola';
    $password = 'lolita';
    $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host;options=$options", 
        "$username","$password");
    $sth = $dbh->prepare("insert into table(foo,bar,baz) values (?,?,?)");
    while(<CSV>) {
        chop;
        my ($foo,$bar,$baz) = split /,/;
        $sth->execute($foo, $bar, $baz);
    }



Ismael Olea 2001-04-21