Re: refresh problem
| From: | Evan Nemerson | Date: | Tue, 27 May 2003 06:05:19 +0000 |
| Subject: | Re: refresh problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149052@lists.php.net to get a copy of this message | ||
You've prolly got a primary key set in your database, and you're trying to
create a row with the same value in whatever column your primary key is as
another value in that column. Primary keys have to be unique- that's why
they're useful
On Monday 26 May 2003 10:58 pm, Riza Fahmi wrote:
> Hi all....!
>
> this is a piece of my code:
>
> ....
> $button_new=$_POST['button_new'];
>
> if ($button_new=="Yes")
> {
> $query_new="INSERT INTO
> jum_kisi(kd_mtk,no_kisi,mu,no_jum_kisi,kd_bmp,
> kd_der_kes,kd_keg_bel,jum_soal,kd_ben_soal)
> VALUES('$sess_kd_mtk',$no_kisi,'$mu',$no_jum_kisi,'$kd_bmp',
> '$kd_der_kes','$kd_keg_bel',$jum_soal,'$kd_ben_soal');";
> $result_new=pg_exec($db_connect,$query_new);
> $t_new="";
> }
> ....
>
> the problems are, when i press refresh/reload from my browser, the
> script do insert again and in my page appear error message : "cannot insert
> a duplicate key..." or something like that. Please help me with this
> problems. Thanks before.
>
>
> ---Riza Fahmi---