Geting stuff out.
This will select the entire row that a field in "columname" is equal to $variable. The DBI will substitute the ? for $variable for you.
use DBI;
con();#<--holds connect info
$sth=$dbh->prepare (qq{
SELECT *
FROM `tablename`
WHERE `columname`=?
} );
$sth->execute ($varible);
my $referencehash= $sth->fetchrow_hashref;
$sth->finish;
dis();
Use selected data:
$data_in_a_column = $referencehash->{columname};
Putting stuff in:
con();
#insert new row
$sth=$dbh->prepare (qq{
INSERT INTO `tablename`
SET `column` = ?, `column2` = ?
} );
$sth->execute ($variable, $variable2);
$sth->finish;
dis();
#updating an existing row
con();
$sth=$dbh->prepare (qq{
UPDATE `tablename`
SET `column` = ?, `column2` = ?
WHERE `somecolumnname`=?
} );
$sth->execute ($variable, $variable2);
$sth->finish;
dis();
haunter@battlestrata.com