Jul 21, 2003 #1 teao Technical User Jul 14, 2003 3 PH simple sample program using perl in database(mysql).
Jul 21, 2003 #2 liuwt Programmer Jul 15, 2003 35 DE Hi, use DBI; $dbh=DBI->connect("dbi:mysql:database=test","user","password" $dbh->do("INSERT INTO sometable(column) VALUES(value)" $sth=$dbh->prepare("SELECT * FROM test" $sth->execute(); while($sth->fetchrow_array()) { print $_; } $sth->finish() $dbh->disconnect(); Also you may read the DBI manual with "perldoc DBI". Hope that helps -- Smash your head on keyboard to continue... Upvote 0 Downvote
Hi, use DBI; $dbh=DBI->connect("dbi:mysql:database=test","user","password" $dbh->do("INSERT INTO sometable(column) VALUES(value)" $sth=$dbh->prepare("SELECT * FROM test" $sth->execute(); while($sth->fetchrow_array()) { print $_; } $sth->finish() $dbh->disconnect(); Also you may read the DBI manual with "perldoc DBI". Hope that helps -- Smash your head on keyboard to continue...
Jul 21, 2003 #3 liuwt Programmer Jul 15, 2003 35 DE correction: not: $sth=$dbh->prepare("SELECT * FROM test" but: $sth=$dbh->prepare("SELECT something FROM test" because thats easier for the "print $_;" below. Greetings -- Smash your head on keyboard to continue... Upvote 0 Downvote
correction: not: $sth=$dbh->prepare("SELECT * FROM test" but: $sth=$dbh->prepare("SELECT something FROM test" because thats easier for the "print $_;" below. Greetings -- Smash your head on keyboard to continue...