Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] Prosty błąd, Print i zmienna
Earth
post
Post #1





Grupa: Zarejestrowani
Postów: 169
Pomógł: 2
Dołączył: 6.12.2006

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


Poniższy kod działa:

  1. <?php
  2. require_once "../../maincore.php";
  3. require_once BASEDIR."subheader.php";
  4. require_once BASEDIR."side_left.php";
  5.  
  6. if (!defined("IN_FUSION") || !checkrights("I")) { header("Location: ../../index.php"); exit; }
  7. if (file_exists(INFUSIONS."nfs_racer_u2/locale/".$settings['locale'].".php")) {
  8.  
  9. include INFUSIONS."nfs_racer_u2/locale/".$settings['locale'].".php";
  10. include INFUSIONS."nfs_racer_u2/settings.php";
  11.  
  12. } else {
  13.  
  14. // Load the infusion's default locale file.
  15. include INFUSIONS."nfs_racer_u2/locale/Polish.php";
  16. include INFUSIONS."nfs_racer_u2/settings.php";
  17. }
  18.  
  19.  
  20.  
  21. opentable( $locale['xxx103'] );
  22.  
  23. print ("
  24. <TABLE WIDTH=100% BORDER=5 BORDERCOLOR=black>
  25. <TR BGCOLOR=#4D4D4D>
  26. <TD WIDTH=40%><FONT color=white>Nick: </FONT></TD>
  27. <TD WIDTH=30%><FONT color=white>GG:</FONT></TD>
  28. <TD WIDTH=15%><FONT color=white>Ostatnio:</FONT></TD>
  29. <TD WIDTH=15%><FONT color=white>Wynik:</FONT></TD>
  30. </TR>");
  31.  
  32. $query = "SELECT * FROM nfsu2_ranking";
  33. $result = mysql_query($query) or die(mysql_error());
  34.  
  35. while ($table = mysql_fetch_array($result))
  36. {
  37. echo "<TR>
  38. <td>".$table['nick']."</td>
  39. <td>".$table['gg']."</td>
  40. <td>".$table['ostatnio']."</td>
  41. <td>".$table['wynik']."</td>
  42. </TR>";
  43. }
  44.  
  45. print ('</TABLE>');
  46.  
  47. closetable();
  48.  
  49. require_once BASEDIR."side_right.php";
  50. require_once BASEDIR."footer.php";
  51. ?>



Po zmianie Nick: na zmienną już nie:

  1. <?php
  2. require_once "../../maincore.php";
  3. require_once BASEDIR."subheader.php";
  4. require_once BASEDIR."side_left.php";
  5.  
  6. if (!defined("IN_FUSION") || !checkrights("I")) { header("Location: ../../index.php"); exit; }
  7. if (file_exists(INFUSIONS."nfs_racer_u2/locale/".$settings['locale'].".php")) {
  8.  
  9. include INFUSIONS."nfs_racer_u2/locale/".$settings['locale'].".php";
  10. include INFUSIONS."nfs_racer_u2/settings.php";
  11.  
  12. } else {
  13.  
  14. // Load the infusion's default locale file.
  15. include INFUSIONS."nfs_racer_u2/locale/Polish.php";
  16. include INFUSIONS."nfs_racer_u2/settings.php";
  17. }
  18.  
  19.  
  20.  
  21. opentable( $locale['xxx103'] );
  22.  
  23. print ("
  24. <TABLE WIDTH=100% BORDER=5 BORDERCOLOR=black>
  25. <TR BGCOLOR=#4D4D4D>
  26. <TD WIDTH=40%><FONT color=white>$locale['xxx104']</FONT></TD>
  27. <TD WIDTH=30%><FONT color=white>GG:</FONT></TD>
  28. <TD WIDTH=15%><FONT color=white>Ostatnio:</FONT></TD>
  29. <TD WIDTH=15%><FONT color=white>Wynik:</FONT></TD>
  30. </TR>");
  31.  
  32. $query = "SELECT * FROM nfsu2_ranking";
  33. $result = mysql_query($query) or die(mysql_error());
  34.  
  35. while ($table = mysql_fetch_array($result))
  36. {
  37. echo "<TR>
  38. <td>".$table['nick']."</td>
  39. <td>".$table['gg']."</td>
  40. <td>".$table['ostatnio']."</td>
  41. <td>".$table['wynik']."</td>
  42. </TR>";
  43. }
  44.  
  45. print ('</TABLE>');
  46.  
  47. closetable();
  48.  
  49. require_once BASEDIR."side_right.php";
  50. require_once BASEDIR."footer.php";
  51. ?>





$locale['xxx104'] znajduje się w pliku Polish.php:
$locale['xxx104'] = "Nick:"

Pokazuje się błąd:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/n/f/s/nfs-pl/www/infusions/nfs_racer_u2/ranking.php on line 31

Ten post edytował Earth 9.12.2006, 15:36:01
Go to the top of the page
+Quote Post
nospor
post
Post #2





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




nie:
  1. <?php
  2. $zm = "$tablica['index']";
  3. ?>


a:
  1. <?php
  2. $zm = "$tablica[index]";
  3. ?>


wiecej info:
http://pl.php.net/manual/pl/language.types.array.php
http://pl.php.net/manual/pl/language.types.string.php


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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: 21.08.2025 - 07:39