Hi Guys, I am a beginner to perl.
I need a perl package which will perform basic DB operations like select , insert,update,delete operation MySql DB.
i Have a Mysql DB which resides on my local machine.DB Deatils are :
Localhost,MySql,DatabaseName:perltest, username:root,pwd:sierra,table:samples with coulms :id,name,phone
I am done with selecting the rows in DB. I need Sample code for inserting , updating and deleting . Please provide some basic infor regarding these.
-
#!/usr/bin/perl -w
-
-
use DBI;
-
-
$dbh = DBI->connect('dbi:mysql:perltest','root','sierra')
-
-
or die "Connection Error: $DBI::errstr\n";
-
-
$sql = "select * from samples";
-
-
$sth = $dbh->prepare($sql);
-
-
$sth->execute
-
-
or die "SQL Error: $DBI::errstr\n";
-
-
while (@row = $sth->fetchrow_array) {
-
-
print "@row\n";
-
-
}
-
Similarly i Need code for Inserting and updating and deleting operations and all these functions as a package. Can guyz help me in how to proceed for these things.
You can mail me ur proceeding to this id EMAILS REMOVED
Thanks in Advance
Koti.