You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by winfield henry <wi...@mindspring.com> on 2002/01/19 20:11:10 UTC

Mysql duplicate entries

I am getting duplicate entries in mysql database using the following and am 
not sure why. Similar code for deleting and modifying the db work fine. Using 
most recent versions of apache/modperl/embperl/mysql.

[- use DBI;
	$driver="DBI:mysql";
	$database="Fitchhillinn";
	($date,$title,$content)=($fdat{date},$fdat{title},$fdat{content});
	my $dbh=DBI->connect("dbi:mysql:$database:localhost",$user,$password) or die 
"Can't connect";
	$dbh->do("INSERT INTO specials VALUES ('$date','$title','$content')");
	$dbh->disconnect; -]
	

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Mysql duplicate entries

Posted by winfield henry <wi...@mindspring.com>.
I discovered it was a glitch with Konqureror browser. Restarted X and all 
seemed ok. I had tried turning off all caching, etc prior without luck. 
Thanks for the reply. 

On Sunday 20 January 2002 11:35 pm, Gerald Richter wrote:
> > I am getting duplicate entries in mysql database using the following and
>
> am
>
> > not sure why. Similar code for deleting and modifying the db work fine.
>
> Using
>
> > most recent versions of apache/modperl/embperl/mysql.
> >
> > [- use DBI;
> > $driver="DBI:mysql";
> > $database="Fitchhillinn";
> > ($date,$title,$content)=($fdat{date},$fdat{title},$fdat{content});
> > my $dbh=DBI->connect("dbi:mysql:$database:localhost",$user,$password) or
>
> die
>
> > "Can't connect";
> > $dbh->do("INSERT INTO specials VALUES ('$date','$title','$content')");
> > $dbh->disconnect; -]
>
> I would expect to see duplicate entries in the DB if you call this page
> twice (for example if anybody make a double click instead of  a single on
> the submit button). If the page is really only called once, there can't be
> duplicates entries, unless you have a second INSERT anywhere else. In the
> other case you have to check before the INSERT if the record already
> exists.
>
> Gerald
>
>
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
>
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Mysql duplicate entries

Posted by Gerald Richter <ri...@ecos.de>.
> I am getting duplicate entries in mysql database using the following and
am
> not sure why. Similar code for deleting and modifying the db work fine.
Using
> most recent versions of apache/modperl/embperl/mysql.
>
> [- use DBI;
> $driver="DBI:mysql";
> $database="Fitchhillinn";
> ($date,$title,$content)=($fdat{date},$fdat{title},$fdat{content});
> my $dbh=DBI->connect("dbi:mysql:$database:localhost",$user,$password) or
die
> "Can't connect";
> $dbh->do("INSERT INTO specials VALUES ('$date','$title','$content')");
> $dbh->disconnect; -]
>

I would expect to see duplicate entries in the DB if you call this page
twice (for example if anybody make a double click instead of  a single on
the submit button). If the page is really only called once, there can't be
duplicates entries, unless you have a second INSERT anywhere else. In the
other case you have to check before the INSERT if the record already exists.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org