
andy7t
User
Oct 12, 2003, 9:04 AM
Post #1 of 3
(363 views)
|
I realise that this should go in the DBI forum, but i didn't think it was complex enough! I'm sure this question is really simple- just not for beginners in MySQL! I've having diffuculty using the DBI module. I'm using many tutorials- but i can't get beyond the SELECT function. I got the SELECT function to work and display whats in the database, but i can't get it to add. This code below is my attempt- it's just the $SQL variable changed to my INSERT command. Any help appreciated. Yhanks use DBI; $dbh = DBI->connect("DBI:mysql:database=$DBNAME;host=$DBHOST;port=3306",$DBUSER,$DBPASS) or print $DBI::errstr; $SQL = " INSERT INTO `people` ('ID','First Name','Last Name','Age','Sex') VALUES('3','Joe','Bloggs','40','M') "; $cursor = $dbh->do($SQL); $cursor->execute; $cursor->finish; $dbh->disconnect;
|