Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Blad przy wysylaniu do bazy mysql
upeertv
post 6.04.2013, 18:41:59
Post #1





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 5.01.2013

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


Witam, mam taki kodzik
  1. <?
  2. if (empty($_POST['comment'])){
  3. echo 'Wyspelnij';
  4.  
  5.  
  6. } else {
  7. if(isset($_POST['oks'])){
  8. $comment = $_POST['comment'];
  9. $id_n = '11';
  10. $kto = 'upeer';
  11. $tresc = 'mama';
  12. $data = '22';
  13. $godzina = '12';
  14. mysql_query("INSERT INTO `comment` (tresc, id_n, kto, data, godzina) VALUES ('".$comment."', '".$id_n."', '".$kto,"', '".$data."', '".$godzina."')");
  15.  
  16.  
  17.  
  18.  
  19. }
  20. }
  21. ?>
  22.  
  23.  
  24. <form action="" method="post">
  25. <input type="text" size="50" style="height: 100px;" name="comment" size="18" />
  26. <input class="button_1" type="submit" name="oks" value="Dodaj">
  27. </form>


w ktorym wwala mi taki bląd

Warning: mysql_query() expects parameter 2 to be resource, string given in /home/upeer/public_html/music.php on line 345

345 linia to ta z zapytanie mysql
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 8)
ber32
post 6.04.2013, 18:49:33
Post #2





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


Witam
A jak wygląda struktura tabeli w bazie napisz


--------------------
Go to the top of the page
+Quote Post
upeertv
post 6.04.2013, 18:51:54
Post #3





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 5.01.2013

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


id_c = int(11) AUTO_INCREMENT
id_n = int(11)
tresc = text
kto = text
data = text
godzina = text
Go to the top of the page
+Quote Post
ber32
post 6.04.2013, 18:57:06
Post #4





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


Może tak

  1. mysql_query("INSERT INTO `comment` (id_c, id_n, tresc, kto, data, godzina) VALUES ('', '".$id_n."', '".$comment."', '".$kto,"', '".$data."', '".$godzina."')");


--------------------
Go to the top of the page
+Quote Post
upeertv
post 6.04.2013, 18:59:34
Post #5





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 5.01.2013

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


niestety nic z tego ;(
Go to the top of the page
+Quote Post
ber32
post 6.04.2013, 19:15:08
Post #6





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


no to może tak

pokombinuj
  1. mysql_query("INSERT INTO `comment` (id_n, tresc, kto, data, godzina) VALUES ('".$id_n."', '".$comment."', '".$kto,"', '".$data."', '".$godzina."')");


a jak tak nie to może z nawiasami

  1. '$id_n'


--------------------
Go to the top of the page
+Quote Post
-Gość-
post 6.04.2013, 19:21:02
Post #7





Goście







'".$kto,"' - teraz widzisz blad? zamiast przecinka wstaw kropke...
Go to the top of the page
+Quote Post
upeertv
post 6.04.2013, 19:37:23
Post #8





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 5.01.2013

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


dziękuje wink.gif
Go to the top of the page
+Quote Post
-Gość-
post 6.04.2013, 19:42:06
Post #9





Goście







nie ma sprawy. rachunek za usluge wyslemy poczta wink.gif
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 13.07.2025 - 01:36