Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Niespodziewany "{"
Mathias666
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 22.01.2008

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


Mam taki fragment kodu:
  1. [...]
  2. <?php 
  3. if ($naz && $naz_link && $logo && $rok && $gat && $gat_link && $poc && $str && $str_link && $ms && $ms_link && $dys) {
  4. $query = "SELECT ID FROM zespol WHERE username='$naz'";
  5. $result = @mysql_query ($query);
  6. if (mysql_num_rows($result) == 0 {
  7.  $query = "INTER INTO zespol (nazwa, nazwa_link, logo_link, rok, gatunek, gatunek_link, pochodzenie, stro
    na, strona_link, myspace, myspace_link, dyskografia) VALUES ('$naz', '$naz_link', '$logo', '$gat', '$gat_link', '$poc', '$str', '$str_link', '$ms', '$ms_link', '$dys', NOW () )"
    ; $result = @mysql_query ($query);
  8.  if ($result) {
  9. echo '<p>Dodano do bazy danych</p>';
  10. exit();
  11. } else {
  12. echo '<p> Błąd systemu, poinformuj o tym administratora</p>';
  13. } 
  14. } else {
  15. echo '<p> Taki album już istnieje </p>';
  16. }
  17. } else {
  18. echo '<p> Spróbuj ponownie, jeśli to nie pomoże skontaktuj się z administratorem </p>';
  19. }
  20. }
  21. ?>


I wywala mi błąd:
Kod
Parse error: syntax error, unexpected '{' in /home/xxxxxxx/ftp/admin/db_band.php on line 98


Tutaj jest to wiersz nr. 6,
Co jest nie tak?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
Sabistik
post
Post #2


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Brakuje zamykającego nawiasu if'a.
Go to the top of the page
+Quote Post
Mathias666
post
Post #3





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 22.01.2008

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


Jest przecież w 21 wierszu.
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #4





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Oj facet... zacznij troszkę myśleć winksmiley.jpg
  1. <?php
  2. if (mysql_num_rows($result) == 0 {
  3. ?>


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
infrat
post
Post #5





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

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


Ja bym proponował jednak tak:

Kod
if (mysql_num_rows($result) == 0) {


Pozdrawiam winksmiley.jpg

Ten post edytował infrat 2.03.2008, 14:39:58
Go to the top of the page
+Quote Post
Zmorcia
post
Post #6





Grupa: Zarejestrowani
Postów: 234
Pomógł: 5
Dołączył: 26.01.2008
Skąd: Lutcza

Ostrzeżenie: (20%)
X----


To to samo !


--------------------
POMOGŁEM ? Wciśnij "Pomógł" , dzięki !
Go to the top of the page
+Quote Post
infrat
post
Post #7





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

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


możliwe, że się nie znam, ale mimo wszystko wydaje mi się, że pewna różnica między:

Kod
if (mysql_num_rows($result) == 0) {

a

Kod
if (mysql_num_rows($result) == 0 {

jest.

Pozdrawiam!
Go to the top of the page
+Quote Post
l0ud
post
Post #8





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

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


Nie zrozumieliście się - Cysiaczek wskazał błąd (chyba na tyle banalny, żeby autor tematu mógł sam go bez problemu poprawić).


--------------------
XMPP: l0ud@chrome.pl
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 Aktualny czas: 20.08.2025 - 07:35