Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for looking!... if(@pics) { my $dbh = SQLStuff->connect_mysql(); my $sth = $dbh->prepare("select * from test_users where user = ? " +) or &justdie("Can't select from table: ",$dbh->errmsg); $sth->execute($got_user_name); #my (@pic1,@pic2,@pic3,@pic4,$flag_pic); my $flag_pic; while (my $row = $sth->fetchrow_hashref()) { #push @pic1,$row->{image_name_1} || ''; #push @pic2,$row->{image_name_2} || ''; #push @pic3,$row->{image_name_3} || ''; #push @pic4,$row->{image_name_4} || ''; if(($row->{image_name_1} ne "") eq ($pics[0] ne "")){$flag_pic +="1";} if(($row->{image_name_2} ne "") eq ($pics[1] ne "")){$flag_pic +="1";} if(($row->{image_name_3} ne "") eq ($pics[2] ne "")){$flag_pic +="1";} if(($row->{image_name_4} ne "") eq ($pics[3] ne "")){$flag_pic +="1";} } #my $check_pic1 = shift(@pic1); #my $check_pic2 = shift(@pic2); #my $check_pic3 = shift(@pic3); #my $check_pic4 = shift(@pic4); print "<br>751**$flag_pic**<br>"; # End check if($flag_pic ne "1") { my $dbh = SQLStuff->connect_mysql(); my $sth = $dbh->prepare("insert into test_add(image_1,image_2,i +mage_3,image_4,image_loc,user) values(?, ?, ?, ?, ?,?)") or &justdie("Can't add data, please try again later! ",$dbh->e +rrmsg); $sth->execute((@pics, undef, undef, undef, undef)[0..3],$path_l +oc[0],$got_user) or &justdie("Can't select from table: ",$dbh->errmsg +); } } ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Duplicity Check Help!
by locked_user sundialsvc4 (Abbot) on Dec 02, 2010 at 14:37 UTC | |
by Anonymous Monk on Dec 02, 2010 at 14:57 UTC | |
|
Re: Duplicity Check Help!
by wallisds (Beadle) on Dec 02, 2010 at 15:27 UTC | |
by Anonymous Monk on Dec 02, 2010 at 16:08 UTC | |
by wallisds (Beadle) on Dec 02, 2010 at 16:21 UTC | |
by wallisds (Beadle) on Dec 02, 2010 at 17:05 UTC | |
by Anonymous Monk on Dec 02, 2010 at 16:47 UTC | |
by wallisds (Beadle) on Dec 02, 2010 at 17:26 UTC |