Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problemy z dodawniem danych
-Wieviór-
post
Post #1





Goście







[php:1:7d65f8660f]
<form action="" method="POST">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><p>Gole gospodarzy:</td>
<td><p>Gole gości:</td>
</tr>
<tr>
<td><input name="hgol"></td>
<td><input name="agol"></td>
</tr>
</table>
<input type="submit" name="submit" value="Wyślij">
</form>
<?
if($_POST['submit']){
$sql= "INSERT INTO live (hgol, agol) VALUES ('".$_POST['hgol']."', '".$_POST['agol']."')";
mysql_query($sql) or die(mysql_error());
}
mysql_close($connect);
?>
[/php:1:7d65f8660f]

Taki błąd(mysql error): Duplicate entry '0' for key 1

Co mam zrobić? Mam w "live" pola: id(index), hgol, agol i jeszcze inne ale nie dotyczy...
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
spenalzo
post
Post #2





Grupa: Zarejestrowani
Postów: 2 064
Pomógł: 1
Dołączył: 22.01.2003
Skąd: Poznań

Ostrzeżenie: (0%)
-----


Rozwiązanie: usuń atrybut UNIQUE ze wszystkich pól.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.12.2025 - 18:26