CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Insert,update,select, delete quires in MySql Using Perl

 



koti688
Novice

Oct 29, 2008, 1:04 AM

Post #1 of 2 (2647 views)
Insert,update,select, delete quires in MySql Using Perl Can't Post

Hi Guyz

i Have a Mysql DB which resides on my local machine. I want to Prepare a Perl Module which will be containing function for the following DB Operations

-Select
-Insert
-Delete
-Update

DB Deatils are :
Localhost,MySql,DatabaseName:perltest, username:root,pwd:sierra

I can able to do the following thing for selecting rows in Db.

Code
#!/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";

}


But not able to do Insert , delet and update operations and made all the functions into a package.coul guyz help me in doing these things. I am a beginner to perl. expecting quick replys from u.

You can mail me ur proceeding to this id koti688@gmail.com or koteswara.devarasetty@sierraatlantic.com

Thanks in Advance
Koti.


FishMonger
Veteran / Moderator

Oct 29, 2008, 12:07 PM

Post #2 of 2 (2638 views)
Re: [koti688] Insert,update,select, delete quires in MySql Using Perl [In reply to] Can't Post

Have you read the section of the DBI doc that explains how and give examples of these tasks?

Can you show us your insert, delete, and update code?

What errors and/or warnings did you get?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives