JackTheRussel
Programmer
Hi !
I cant solve this problem by my self and I'll need some help.
I have program which works followin way:
I get information and and I parse that and I get variables:
and then I insert these variables to the database.
And I also have table called
where I have samekind of data like I have in $first variables
Now before insert sentence I would like to check do I have already same data in the @ecual table like I have in $first variable.
If there are already same data then do nothing and move to the next record and so on...
But if there arent that data. Then I would like to execute that insert sentence and take them to the database.
How I should do this ? I cant solve this problem?
I cant solve this problem by my self and I'll need some help.
I have program which works followin way:
I get information and and I parse that and I get variables:
Code:
$first, $second and $third
Code:
open(FILE, $filename);
my @lines=<FILE>;
foreach $t (@lines){
my $str = $t;
my ($first, $second, $third) = split(/\s/, $str, 3);
my $sql_string="insert into table set model='$first', stat='$second', layer='$third'";
$sth = $db_connection->prepare($sql_string);
$sth->execute();
}
And I also have table called
Code:
@ecul
Now before insert sentence I would like to check do I have already same data in the @ecual table like I have in $first variable.
If there are already same data then do nothing and move to the next record and so on...
But if there arent that data. Then I would like to execute that insert sentence and take them to the database.
How I should do this ? I cant solve this problem?