Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]Problem z tokenem
monter2313
post 28.02.2012, 14:59:52
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.02.2012

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


  1. <html>
  2. <head>
  3. </head>
  4.  
  5. <?
  6. ini_set('display_errors','1');
  7.  
  8.  
  9. $tytul = $_POST['Nazwa'];
  10. $tresc = $_POST['Tresc'];
  11. $miejscowosc = $_POST['Miejscowosc'];
  12. $numer = $_POST['Numer_tel_oferty'];
  13.  
  14. $id = $_GET['id'];
  15. if(file_exists("CONFIG/config.php")) require_once("CONFIG/config.php");
  16. connect();
  17.  
  18. $zapytanie = "UPDATE ".PREFIX."oferty
  19. SET Nazwa_oferty = '$tytul' Tresc_oferty = '$tresc' Miejscowosc_oferty = '$miejscowosc' Numer_tel_oferty = '$numer'
  20. WHERE Id_oferty = '".$_GET['id']."';
  21. $wynik = mysql_query($zapytanie) or die (mysql_error());
  22. close();
  23.  
  24.  
  25. ?>
  26.  
  27.  
  28. <body>
  29. <form method='POST' action='ogloszenia.php'>
  30. <button type="submit" name="Zobacz_ogloszenia" style="background-color: blue; width:400px; height:40px;background-repeat: no-repeat; background-size: 150% 150%;font-size:20pt;color: white; position: relative; left: 0px; top: 240">Zobacz ogloszenia</button>
  31. </form>
  32. </body>
  33. </html>


Błąd Parse error: syntax error, unexpected T_STRING in /home/students/ie2012/magick7/public_html/new/edytuj_oglo2.php on line 31


Oświeci mnie ktoś co za błąd popełniłem... sad.gif PHP byc ciężkie
Go to the top of the page
+Quote Post
sadistic_son
post 28.02.2012, 15:04:14
Post #2





Grupa: Zarejestrowani
Postów: 1 487
Pomógł: 245
Dołączył: 1.07.2009
Skąd: Bydgoszcz

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


Linijka 21:
  1. WHERE Id_oferty = '".$_GET['id']."'";
Forum to nie parser.


--------------------
Uśpieni przez system, wychowani przez media,
Karmieni zmysłami, próżnymi żądzami...

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Jesteś zbyt leniwy, żeby się zarejestrować? Ja jestem zbyt leniwy aby Ci pomóc!
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Go to the top of the page
+Quote Post
monter2313
post 28.02.2012, 15:16:33
Post #3





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.02.2012

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


Notice: Undefined index: id in /home/students/ie2012/magick7/public_html/new/edytuj_oglo2.php on line 15

Notice: Undefined index: id in /home/students/ie2012/magick7/public_html/new/edytuj_oglo2.php on line 21
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 'Tresc_oferty = 'Spanie' Miejscowosc_oferty = 'Poznan' Numer_tel_oferty = '600600' at line 2

Wybaczcie dopiero się uczę ;/ wstydnis.gif

Ten post edytował monter2313 28.02.2012, 15:17:01
Go to the top of the page
+Quote Post
Majkelo23
post 28.02.2012, 15:33:35
Post #4





Grupa: Zarejestrowani
Postów: 226
Pomógł: 17
Dołączył: 13.02.2012

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


  1. WHERE Id_oferty = '".$_GET['id']."';


jak już to:

  1. WHERE Id_oferty = '".$_GET['id']."'";


Ale powinieneś to zapisać tak naprawdę tak:

  1. WHERE Id_oferty = ".$_GET['id'].";


Bo ID to nie string.

A co do drugiego błędu, to po prostu localhost Ci go wywala, na normalnym serwerze będzie ok.

EDIT:
Przecież u góry ktoś podał Ci tą samą odp! Korzystaj chociaż z tego co Ci ludzie piszą...

Ten post edytował Majkelo23 28.02.2012, 15:35:38
Go to the top of the page
+Quote Post
monter2313
post 28.02.2012, 15:41:58
Post #5





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.02.2012

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 'Tresc_oferty = 'Spanie' Miejscowosc_oferty = 'Poznan' Numer_tel_oferty = '600600' at line 2

Zmieniłem i cały czas to samo

Edit: Juz mi sie udało samemu zmienić problem pozostaje z bazą

Ten post edytował monter2313 28.02.2012, 15:45:29
Go to the top of the page
+Quote Post
Barcelona
post 28.02.2012, 15:48:05
Post #6





Grupa: Zarejestrowani
Postów: 322
Pomógł: 15
Dołączył: 29.01.2010

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


Tak się wtrące, po co dajesz w zapytaniu $_GET['id'], skoro zadeklarowałeś
  1. $id = $_GET['id'];
Go to the top of the page
+Quote Post
monter2313
post 28.02.2012, 18:32:32
Post #7





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.02.2012

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


Pomyliłem wielkosc tokenów> juz działa
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: 25.05.2024 - 23:22