help with DBD error

2001-12-20 Thread FLAHERTY, JIM-CONT


hello, I have redhat 7.1 and perl is loaded with mysql , I have several
scripts with perl , DBI, DBD and mysql working fine , so If think I have
everything set up properly 


But I get an error :





DBD::mysql::st execute failed: Duplicate entry '204' for key 1 at
/var/www/cgi-b

in/sobt/chstatus2.cgi line 107.
 unable to execute query  at /var/www/cgi-bin/sobt/chstatus2.cgi line 107.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().




this is the section of code ( with line numbers)  



 97  $dbh2 =DBI ->connect($data_source, $username, $password);

 98my $sth2 = $dbh2 -> prepare("select title from media1 where num
='$nu
m'");
 99 
100$sth2 -> execute or die " unable to execute query ";
101 
102 
103  $dbh2 =DBI ->connect($data_source, $username, $password);

104my $sth2 = $dbh2 -> prepare("insert into
history(num,title,date,user1
)values('$num','$date1','$date1','$name')");
105 
106 
107$sth2 -> execute or die " unable to execute query ";
108 
109 
110 






Help 

Thanks
 Jim F

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help with DBD error

2001-12-20 Thread Maxim Berlin

Hello JIM-CONT,

Thursday, December 20, 2001, FLAHERTY, JIM-CONT <[EMAIL PROTECTED]> wrote:


FJC> hello, I have redhat 7.1 and perl is loaded with mysql , I have several
FJC> scripts with perl , DBI, DBD and mysql working fine , so If think I have
FJC> everything set up properly 

FJC> But I get an error :

FJC> DBD::mysql::st execute failed: Duplicate entry '204' for key 1 at
FJC> /var/www/cgi-bin/sobt/chstatus2.cgi line 107.

looks like you trying to insert record into your database with the
primary key, which already exists.

FJC>  unable to execute query  at /var/www/cgi-bin/sobt/chstatus2.cgi line 107.
FJC> Issuing rollback() for database handle being DESTROY'd without explicit
FJC> disconnect().

FJC> this is the section of code ( with line numbers)  

FJC>  97  $dbh2 = DBI ->connect($data_source, $username, $password);

FJC>  98my $sth2 = $dbh2 -> prepare("select title from media1 where num 
='$num'");
FJC>  99 
FJC> 100$sth2 -> execute or die " unable to execute query ";
FJC> 101 
FJC> 102 
FJC> 103  $dbh2 =DBI ->connect($data_source, $username, $password);
FJC> 104   my $sth2 = $dbh2 -> prepare("insert into 
history(num,title,date,user1)values('$num','$date1','$date1','$name')");
FJC> 105 
FJC> 106 
FJC> 107   $sth2 -> execute or die " unable to execute query ";
FJC> 108 
FJC> 109 
FJC> 110 



Best wishes,
 Maximmailto:[EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]