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] Verkaufspferdeauflistung inkl. Verlinkung (https://www.gegen-bilderklau.net/thread.php?threadid=176539)
Geschrieben von Kullakeeeks am 22.10.2010 um 15:33:
Verkaufspferdeauflistung inkl. Verlinkung
Okay, nun habe ich den richtigen Code, allerdings wäre es nun noch schön, wenn man den Namen mit dem Steckbrief verlinken könnte.
Nur wie stellt man das an, weil es ja verschiedene IDs bei den Pferden gibt?!?!
Hier erstmal der aktuelle Code, in den noch die Verlinkung eingefügt werden muss:
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
Nur Pferde anzeigen mit<br>
Geschlecht: <a href="http://ponyhofivanhoe.bplaced.de/pferde/pony/stute.php">Stute</a>
- <a href="hengst.php">Hengst</a> - <a href="wallach.php">Wallach</a><br>
Haupteignung: Dressur - Springen - Vielseitigkeit - Western<br>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = ''";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_array($ergebnis))
{ ?>
<tr>
<td width="15%"><?php echo " <img src="".$row["Vorschaubild"]."">";
?>
</td>
<td width="15%"><?php echo $row["Name"]; ?></td>
<td width="15%"><?php echo $row["Rasse"];; ?></td>
<td width="15%"><?php echo $row["Geschlecht"]; ?></td>
<td width="15%">*<?php echo $row["Alter"]; ?></td>
<td width="15%"><?php echo $row["Wert"]; ?>€</td>
</tr>
<?php } ?>
</tbody>
</table>
</center>
</body>
</html>
|
|
Geschrieben von Kullakeeeks am 22.10.2010 um 16:21:
Habs geändert, geht aber immernoch nicht...
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = '' ORDER BY id LIMIT ".$seite.",".$proseite; // Datenabfrage
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{ ?>
<tr>
<td width="15%"> <img
src="%3C?=%20$row-%3Evorschaubild%20?%3E"></td>
<td width="15%"><?php echo"$row[Name]" ?></td>
<td width="15%"><?php echo"$row[Rasse]" ?></td>
<td width="15%"><?php echo"$row[Geschlecht]" ?></td>
<td width="15%"><?php echo"$row[Alter]" ?></td>
<td width="15%"><?php echo"$row[Preis]" ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</center>
</body>
</html>
|
|
Geschrieben von Skadi am 22.10.2010 um 16:47:
Probier mal anstatt $row[SPALTE], $row->SPALTE ;D
Mfg; Skadi
Geschrieben von kext am 22.10.2010 um 16:48:
Die Funktion mysql_fetch_object gibt, wie der Name schon sagt, ein Objekt zurück und kein Array. Auf Eigenschaften eines Objekts greift man mit -> zu, also $row->id. Besser ist aber, wenn du einfach mysql_fetch_array benutzt.
Mal ganz davon abgesehen schlägt schon die Abfrage fehl, da $seite und $proseite nicht definiert sind.
Geschrieben von Kullakeeeks am 22.10.2010 um 17:00:
Okay, ich hab den Code von meinem alten vRh genommen...
Wie muss ich $seite und $proseite denn definieren?
Geschrieben von Skadi am 22.10.2010 um 17:03:
Was willst du denn damit sagen?
Geschrieben von kext am 22.10.2010 um 17:06:
Bei LIMIT gibst du an, welcher der erste Datensatz sein soll (beginnend bei null), gefolgt von der Anzahl der Einträge.
LIMIT 0, 10 zeigt die ersten zehn Einträge.
LIMIT 5, 5 zeigt die Einträge 5, 6, 7, 8, 9 und 10.
Für Seite $seite mit $proseite Einträge ist das also:
$abfrage = "... LIMIT ".(($seite - 1) * $proseite).", ".$proseite;
Geschrieben von Kullakeeeks am 22.10.2010 um 17:06:
Keine Ahnung, das war im Code, den meine damalige MB erstellt hat, ich hab ihn einfach übernommen und mit meinen daten angepasst soweit...
Sieht da so aus:
klick
LG
Geschrieben von Kuhmuhphu am 22.10.2010 um 19:34:
Zitat: |
Original von Mutzelchen
Hast du die Datenbankzugangsdaten richtig eingegeben? |
Das wollte ich auch gerade fragen.. denn die Fehlermeldungen vor der Tabelle sind typisch für falsche Verbindungsdaten
Geschrieben von Kullakeeeks am 22.10.2010 um 19:46:
Ja, die stimmen, für die Steckbriefe nutz ich auch "db.php" und da gehts ja auch...
Geschrieben von Kullakeeeks am 22.10.2010 um 20:05:
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = '' ORDER BY id LIMIT ".$seite.",".$proseite; // Datenabfrage
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{ ?>
<tr>
<td width="15%"> <img
src="%3C?=%20$row-%3Evorschaubild%20?%3E"></td>
<td width="15%"><?php echo"$row[Name]" ?></td>
<td width="15%"><?php echo"$row[Rasse]" ?></td>
<td width="15%"><?php echo"$row[Geschlecht]" ?></td>
<td width="15%"><?php echo"$row[Alter]" ?></td>
<td width="15%"><?php echo"$row[Preis]" ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</center>
</body>
</html>
|
|
Geschrieben von Kullakeeeks am 22.10.2010 um 20:14:
Erledigt, jetzt kommt das:
"Fatal error: Call to a member function mysql_fetch_object() on a non-object in /users/ponyhofivanhoe/www/pferde/pony/verkaufspferde.php on line 37"
Code:
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = '' ORDER BY id LIMIT ".$seite.",".$proseite; // Datenabfrage
$ergebnis = mysql_query($abfrage);
while($row -> mysql_fetch_object($ergebnis))
{ ?>
<tr>
<td width="15%"> <img
src="%3C?=%20$row-%3Evorschaubild%20?%3E"></td>
<td width="15%"><?php echo"$row->Name"; ?></td>
<td width="15%"><?php echo"$row->Rasse"; ?></td>
<td width="15%"><?php echo"$row->Geschlecht"; ?></td>
<td width="15%"><?php echo"$row->Alter"; ?></td>
<td width="15%"><?php echo"$row->Preis"; ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</center>
</body>
</html>
|
|
Geschrieben von Kullakeeeks am 22.10.2010 um 20:20:
Naja...irgendwas ist immernoch falsch...
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = ''
$ergebnis = mysql_query($abfrage);
while($row -> mysql_fetch_object($ergebnis))
{ ?>
<tr>
<td width="15%"> <img
src="%3C?=%20$row-%3Evorschaubild%20?%3E"></td>
<td width="15%"><?php echo"$row->Name"; ?></td>
<td width="15%"><?php echo"$row->Rasse"; ?></td>
<td width="15%"><?php echo"$row->Geschlecht"; ?></td>
<td width="15%"><?php echo"$row->Alter"; ?></td>
<td width="15%"><?php echo"$row->Preis"; ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</center>
</body>
</html>
|
|
=> Parse error: syntax error, unexpected T_LNUMBER in /users/ponyhofivanhoe/www/pferde/pony/verkaufspferde.php on line 41
Geschrieben von Kullakeeeks am 22.10.2010 um 20:35:
Also ich hab jetzt alles umgesetzt, aber es geht trotzdem nicht...
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = ''"
$ergebnis = mysql_query($abfrage);
while($row -> mysql_fetch_object($ergebnis))
{ ?>
<tr>
<td width="15%"><?php echo" <img src="".$row[Vorschaubild]."">";
?>
</td>
<td width="15%"><?php echo"$row->"Name"; ?></td>
<td width="15%"><?php echo"$row->"Rasse"; ?></td>
<td width="15%"><?php echo"$row->"Geschlecht"; ?></td>
<td width="15%"><?php echo"$row->"Alter"; ?></td>
<td width="15%"><?php echo"$row->"Preis"; ?></td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
|
|
=> Parse error: syntax error, unexpected T_VARIABLE in /users/ponyhofivanhoe/www/pferde/pony/verkaufspferde.php on line 36
Geschrieben von Kullakeeeks am 22.10.2010 um 20:40:
nope...
"Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '{' or '$' in /users/ponyhofivanhoe/www/pferde/pony/verkaufspferde.php on line 41"
Geschrieben von Kullakeeeks am 22.10.2010 um 20:51:
Muss da nur ein ; hinter?
Geschrieben von Kullakeeeks am 22.10.2010 um 21:01:
Es ändert sich nichts, egal, wo ich die Klammer schließe...
Geschrieben von Kullakeeeks am 22.10.2010 um 21:09:
Ja schon, aber die Klammer steht ja schon in nem php-Tag, also die php-Tags gehen alle auf und zu, nur die doofe Klammer geht nicht wieder zu, aber die Tags sind vollständig...
Geschrieben von Kullakeeeks am 22.10.2010 um 21:17:
Also ich hab das while jetzt in nen eigenen tag gepackt...
Aber die Klammwer ist immernoch alleine...
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:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
<title>Ponyhof Ivanhoe</title>
</head>
<body>
<center>
<table width="90%">
<tbody>
<tr>
<th width="15%"><b>Vorschau</b></th>
<th width="15%"><b>Name</b></th>
<th width="15%"><b>Rasse</b></th>
<th width="15%"><b>Geschlecht</b></th>
<th width="15%"><b>Alter</b></th>
<th width="15%"><b>Preis</b></th>
</tr>
<?php include("db.php"); $abfrage = "SELECT * FROM pferd WHERE Besitzer = ''";
$ergebnis = mysql_query($abfrage); ?>
<?php while($row -> mysql_fetch_object($ergebnis));
{ ?><tr>
<td width="15%"><?php echo " <img src="".$row->"Vorschaubild"."">";
?>
</td>
<td width="15%"><?php echo $row->"Name"; ?></td>
<td width="15%"><?php echo $row->"Rasse"; ?></td>
<td width="15%"><?php echo $row->"Geschlecht"; ?></td>
<td width="15%"><?php echo $row->"Alter"; ?></td>
<td width="15%"><?php echo $row->"Preis"; ?></td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
|
|
Geschrieben von Kullakeeeks am 22.10.2010 um 21:25:
Ich habs jetzt eingefügt, aber es kommt immernoch das:
"Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '{' or '$' in /users/ponyhofivanhoe/www/pferde/pony/verkaufspferde.php on line 41"
Forensoftware: Burning Board, entwickelt von WoltLab GmbH