Gegen Bilderklau - Das Original (https://www.gegen-bilderklau.net/index.php)
- Design, Website, Copyright (https://www.gegen-bilderklau.net/board.php?boardid=80)
--- Homepagehilfe (https://www.gegen-bilderklau.net/board.php?boardid=27)
---- Homepagehilfe - Archiv (https://www.gegen-bilderklau.net/board.php?boardid=139)
----- [PHP & MySQL] PHP Steckbrief - Verweis zur Tabelle? (https://www.gegen-bilderklau.net/thread.php?threadid=147468)
Geschrieben von Morgan Girl am 29.12.2008 um 13:41:
PHP Steckbrief - Verweis zur Tabelle?
Hallo erstmal
ich hab da eine Frage:
Ich habe meinen Steckbrief ausschließlich mit Variablen gefüllt. Jetzt hat jedes Pferd die gleiche Tabelle mit den Variablen drin, nur der PHP-Teil ganz oben unterscheidet sich durch die ID. Jetzt wollte ich, dass die Tabelle eine extra Datei ist (Tabelle.php) und ich die durch einen Verweis (<object> </object>) in jeder Seite anzeigen lassen kann. Mein Steckbrief hat nur eine Seite. Jedes Pferd hat dann nur noch eine Seite wo dann der entsprechende php-header drauf is.
Falls ich nun die Farbe der Tabelle ändern wollte, müsste ich nur die Datei Tabelle.html ändern.
Schöne Idee, klappt nur nicht so wie ich das wollte. Die Tabelle wird zwar angezeigt, allerdings die Variablen nicht. (Kann rein logisch auch gar nicht so funktionieren, aber deswegen will ich ja wissen wies geht)
Jetzt meine Frage: ist es iwie möglich, dass ich die Seiten so verknüpfen kann, dass ich nicht auf jede Pferde-Seite die Tabelle reinsetzen muss?
lg Morgan
Hier die Codes:
Mein Pferd heißt Pferd1.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
|
<html>
<head>
<title>Titel des Hofes</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php
include("Datenbank.php");
$id = "$_GET[1]";
$Ergebnis = mysql_query( "SELECT * FROM pferd where ID='1'" );
if (@mysql_num_rows($Ergebnis) == 0) {
echo "Dieses Pferd existiert nicht!";
}
else {
$Data = mysql_fetch_array( $Ergebnis );
}
?>
<object data="Tabelle.php" type="php" width="700" height="1200">
<param name="src" value="Tabelle.php">
Ihr Browser kann das Objekt leider nicht anzeigen!
</object>
</body>
</html>
|
|
Und hier die Tabelle.php
php: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
|
<table style="padding: 20px; font-family: Verdana; font-size: 12px; color: rgb(232, 245, 184); text-align: center;" align="center" width="500">
<tbody><tr><td colspan="3" height="50" width="100%"><font color="#8ead1e" size="6"><?php echo"$Data[Name]"?></font>
</td></tr><tr><td> </td></tr>
<tr><td colspan="3" bgcolor="#8ead1e" height="25" width="100%"><b>Infos</b></td>
</tr>
<tr>
<td bgcolor="#aac254" colspan="3" width="100%"><img src="<?php echo"Pferd$Data[ID]"?>.png" border="0"></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Zuchtname</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Zuchtname]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Rasse</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Rasse]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Geschlecht</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Geschlecht]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Alter</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Alter]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Farbe</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Farbe]"?></td>
</tr>
<tr><td> </td></tr>
<tr>
<td colspan="3" bgcolor="#8ead1e" height="25" width="100%"><b>Pflegezustand</b></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Gesundheit</td>
<td bgcolor="#aac254" colspan="2"><?php echo"$Data[Gesundheit]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Hufe</td>
<td bgcolor="#aac254" colspan="2"><?php echo"$Data[Hufe]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Sauberkeit</td>
<td bgcolor="#aac254" colspan="2"><?php echo"$Data[Sauberkeit]"?></td>
</tr>
<tr><td> </td></tr>
<tr>
<td bgcolor="#8ead1e" colspan="3" height="25" width="100%"><b>Ausbildung</b></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Dressur</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Dressur]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Springen</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Springen]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Military</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Military]"?></td>
</tr>
<tr><td> </td></tr>
<tr>
<td bgcolor="#8ead1e" colspan="3" height="25" width="100%"><b>Allgemeines</b></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Stall</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Stall]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Besitzer</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Besitzer]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Wert</td>
<td bgcolor="#aac254" colspan="2" width="50%"><img src="Geld.png"> <?php echo"$Data[Wert]"?></td>
</tr>
<tr><td> </td></tr>
<tr>
<td bgcolor="#8ead1e" colspan="3" height="25" width="100%"><b>Charakter</b></td></tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Vertrauen</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Vertrauen]"?></td></tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Temperament</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Temperament]"?></td></tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Ausgeglichenheit</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Ausgeglichenheit]"?></td></tr>
<tr>
<td bgcolor="#8ead1e" height="25" width="50%">Zufriedenheit</td>
<td bgcolor="#aac254" colspan="2" width="50%"><?php echo"$Data[Zufriedenheit]"?></td>
</tr>
<tr>
<td colspan="3" bgcolor="#aac254" width="50%"><?php echo"$Data[Charakter]"?></td>
</tr>
<tr><td> </td></tr>
<tr><td bgcolor="#8ead1e" colspan="3" height="25" width="100%"><b>Stammbaum</b></td></tr>
<tr>
<td height="25"> </td>
<td> </td>
<td bgcolor="#aac254"><?php echo"$Data[VGv]"?></td>
</tr>
<tr>
<td height="25"> </td>
<td bgcolor="#aac254"><?php echo"$Data[V]"?></td>
<td> </td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
<td bgcolor="#aac254"><?php echo"$Data[VGm]"?></td>
</tr>
<tr>
<td bgcolor="#8ead1e" height="25"><b><?php echo"$Data[Zuchtname]"?></b></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
<td bgcolor="#aac254"><?php echo"$Data[MGv]"?></td>
</tr>
<tr>
<td height="25"> </td>
<td bgcolor="#aac254"><?php echo"$Data[M]"?></td>
<td> </td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
<td bgcolor="#aac254"><?php echo"$Data[MGm]"?></td>
</tr>
</tbody></table>
|
|
Geschrieben von Black Katrin am 29.12.2008 um 13:52:
lies mal was du geschrieben hast... logisch kanns nit gehen wenn du .html endung schreibst!!! teilweise versteh ich wirklich nit wie solche fehler passieren können wenn man doch angeblich php lernt... ads gehört zu den dingen die man als erstes lernt
Geschrieben von Morgan Girl am 29.12.2008 um 13:53:
ja ich habs auch nachm absenden gemerkt. also gehn wir von Tabelle.php aus xD
klappt aber trotzdem nich, habs schon ausprobiert
Geschrieben von Black Katrin am 29.12.2008 um 14:01:
kannsu das ganze mal kurz in PHP statt Code einfügen? adnn wird es so hübsch bunt

ich kann das zeug leider nimmer ohen farben lesen
Geschrieben von Morgan Girl am 29.12.2008 um 14:08:
hab ich.
aber wie gesagt, auch mit php endung klappts nich.
theoretisch müsste ja der php-teil aus pferd1.php in die tabelle, allerdings so dass er dann durch den in pferd1 quasi ersetzt wird xD *verstehst du was ich meine?^^*
Geschrieben von Melli am 29.12.2008 um 18:45:
Ginge es nicht auch mit einem include, statt dem <object>-Tag? x:
php: |
1:
|
include("Tabelle.php"); |
|
Halt in den php-Teil.
Geschrieben von Morgan Girl am 30.12.2008 um 12:36:
probier ich grad mal aus
//edit die tabelle wird zwar angezeigt, aber ohne die werte.
Geschrieben von Melli am 30.12.2008 um 18:29:
Wohin hast du es denn geschrieben?
Versuchs mal hierhin zu stellen:
php: |
1:
2:
3:
4:
|
else {
$Data = mysql_fetch_array( $Ergebnis );
include("Tabelle.php");
} |
|
Geschrieben von Morgan Girl am 30.12.2008 um 19:33:
ahhhhhhhhhhhhhhhhh
du bist genial
100000000000000000000 mal dankeschön
mein Tag ist gerettet!
Ich glaube das könnte auch für andere noch hilfreich sein
Forensoftware: Burning Board, entwickelt von WoltLab GmbH