Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z tabela...
lan
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.11.2006

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


Witam mam ttaki problem ze dane ktore wysylam do tabelinie chca tam dojsc ;/ nie wiem o co chodzi
formularz:
  1. <head>
  2. Test formularza
  3. </title>
  4. </head>
  5. <body>
  6. <form action="test.php" method="GET">
  7. Team: <input type=text name="team"/><br/>
  8. <input type=submit value="Wyslij"/>
  9. </form>
  10. </body>
  11. </html>


skrypt:
  1. Team: <?php echo $_GET['team']?><br>
  2. <?php
  3. $db = mysql;
  4. $conn=mysql_connect("localhost","root","haslo") or die ("Nie mozna polaczyc z baza danych!");
  5. mysql_select_db("net_soccer", $conn);
  6. $result= mysql_query("INSERT INTO dane VALUES ('', 'team')") or die ("cos nie tak przy wpisywaniu");
  7. ?>


Nie wiem o co chodzi ;(
Go to the top of the page
+Quote Post
batman
post
Post #2





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




  1. <?php
  2. $result= mysql_query("INSERT INTO dane VALUES ('', '".$_GET['team']."')") or die ("cos nie tak przy wpisywaniu");
  3. ?>
Go to the top of the page
+Quote Post
lan
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.11.2006

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


Dzieki za pomoc.. ale niestety to samo ;/ wyswietla mi sie "cos nie tak przy wpisywaniu" a w tabeli jak nic nie bylo, tak nic nie ma.
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




nie : or die ("cos nie tak przy wpisywaniu");
a : or die (mysql_error());
Go to the top of the page
+Quote Post
lan
post
Post #5





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.11.2006

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


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''', 'jakisteam')' at line 1
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




hmmm, oczekiwalem innego bledu.
Sprobuj moze zamiast '' dac null, bo rozumiem ze tam masz ID autoincrement? A jesli i to nie pomoze to znaczy ze sie starzeję
Go to the top of the page
+Quote Post
lan
post
Post #7





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.11.2006

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


DZIALA!!!! dzieki
Go to the top of the page
+Quote Post
batman
post
Post #8





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Możesz jeszcze zrobić tak:

  1. <?php
  2. $result= mysql_query("INSERT INTO dane (nazwa_twojego_pola) VALUES ('".$_GET['team']."')");
  3. ?>
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: 9.10.2025 - 02:19