Central Indiana Linux Users Group
User: Guest Log in |  Join
MySQL Presentation
First page Back Continue Last page Overview Graphics

Connecting via Perl (example)

  • use DBI;

  • use DBD::mysql;

  • $dsn = "DBI:mysql:database=$db;host=$ds";

  • $dbh = DBI->connect($dsn,$login,$passwd);

  • $query = “select photos_id, caption from Photos where date = '2001-08-18‘”

  • $sth = $dbh->prepare($query);

  • $sth->execute();

  • while (($id,$caption) = $sth->fetchrow_array()) {

  • print “$id: $caption\n:;

  • }


Notes:

Apr. 1, 2004 2:54 pm US/Eastern