Thread SQL Tabelle: "Insert Into Table" falls Daten nicht vo (5 answers)
Opened by nour at 2006-11-28 13:50

renee
 2006-11-28 15:14
#34926 #34926
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
ungetestet:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
my $neid = 2329;
my $query = "SELECT Root.NEID, State.NEID FROM Root, State WHERE Root.NEID = ?";
my $sth = $dbh->prepare($query) or die $dbh->errstr();
$sth->execute($neid);

my ($root,$state) = $sth->fetchrow_array();

if(not defined $state){
$dbh->do("INSERT INTO State(NEID) VALUES(?)",undef,$neid) or die $dbh->errstr();
}

if(not defined $root){
$dbh->do("INSERT INTO Root(NEID) VALUES(?)",undef,$neid) or die $dbh->errstr();
}



Allgemein: Du solltest Dir mal Wiki:[tt]use strict[/tt] anschauen!
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread SQL Tabelle: "Insert Into Table" falls Daten nicht vo