Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML]Co tu jest źle?
kayy
post
Post #1





Grupa: Zarejestrowani
Postów: 112
Pomógł: 1
Dołączył: 3.08.2008

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


[phpwhile($super = mysql_fetch_array($dwa)){
echo "<p>";
if (!empty($super[2])) echo "<a href="$super[2]"> <img border=0 src="."$super[2]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75/></a>";
if (!$super[3] == '') echo "<a href="$super[3]"><img border=0 src="."$super[3]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75"."/></a><br>";
if (!$super[4] == '') echo "<a href="$super[4]"> <img border=0 src="."$super[4]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75"."/></a>";
if (!$super[5] == '') echo "<a href="$super[5]"><img border=0 src="."$super[5]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75"."/><br></a>";
if (!$super[6] == '') echo "<a href="$super[6]"><img border=0 src="."$super[6]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75"."/></a>";
if (!$super[7] == '') echo "<a href="$super[2]"><img border=0 src="."$super[7]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75"."/></p></a>";


}

[/php]


Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /show.php on line 25

25 linia:
  1. <?php
  2. if (!empty($super[2])) echo "<a href="$super[2]"> <img border=0 src="."$super[2]"." alt="."."."opis"." style="."float:right"." width="."75"." height="."75/></a>";
  3. ?>


Ehh... nie mogę wtf?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
JoShiMa
post
Post #2





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


Żeby było naprawdę optymalnie to powinno wyglądac tak:
  1. <?php
  2. echo "<a href=\"$super[2]\"> <img src=\"$super[2]\".' alt="opis" style="float:right; width:75px; height:75px; border:0;" /></a>';
  3. ?>


Kilka spraw:
1. Jeśli nie wstawiasz do stringu zmiennej używaj pisz string w znacznikach '. Przetwarzanie będzie szybsze i czytanie kodu łatwiejsze, bo wewnątrz możesz wstawiać normalne "
2. Nie mieszaj stylów i atrybutów. Jeśli już zdecydowałeś się na style to zamiast korzystać z atrybutu border, width, height ito wrzuć to do stylu.
Go to the top of the page
+Quote Post

Posty w temacie


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: 5.10.2025 - 15:15