# Our program for today...

## 1: #!/usr/bin/perl -w

## 2:

## 3: use DBI;

## 4:

## 5: $dbh = DBI->connect('', '', '', { RaiseError => 1 });

## 6:

## 7: $upd = $dbh->prepare("UPDATE prices SET price=? WHERE prod_id=?");

## 8: $ins = $dbh->prepare("INSERT INTO prices (prod_id,price) VALUES(?,?)");

## 9: $rows = $upd->execute(42, "Widgets");

## 10: $ins->execute("Widgets", 42) if $rows == 0;

## 11:

## 12: $dbh->disconnect;

Previous slide | Next slide | Back to first slide | View graphic version