News-System funktioniert nicht
lima-city → Forum → Programmiersprachen → PHP, MySQL & .htaccess
anzeigen
code
dank
datenbank
datum
erfolgreiche landung
erstellen
fehler
folgendes problem
http
inhalt
jemand
ordern
problem
sagen
system
tabelle
verbindung
-
Ich wollte gerade ein News-System erstellen.
Nun habe ich folgendes Problem.
So Sieht meine Tabelle aus:
http://i.epvpimg.com/WFbHe.png
So sieht das Script aus:
<?php mysql_connect("localhost", "root", "") or die ("Keine Verbindung moeglich"); mysql_select_db("appsklima") or die ("Die Datenbank existiert nicht"); $result = mysql_query("SELECT * FROM themes ORDER BY datum ASC"); $row = mysql_fetch_object($result); $thema = $row->thema; $inhalt = $row->inhalt; $author = $row->author; $datum = $row->datum; echo $thema; echo "</br>"; echo $inhalt; echo "</br>"; echo $author; echo "</br>"; echo $datum; echo "</br>"; ?>
Was rauskommt:
Erfolgreiche Landung
abore et dolore magna aliquyam erat, sed diam volu
Unknown
2012-11-11
Kann mir jemand bitte sagen was mein Fehler ist. -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage
-
Was genau ist jetzt Dein Problem? Es funktioniert doch offensichtlich alles!?
Oder möchtest Du alle News anzeigen?
Dann musst Du den Code so ändern:
12345678910111213141516171819202122232425262728293031<?php
mysql_connect(
"localhost"
,
"root"
,
""
)
or
die
(
"Keine Verbindung moeglich"
);
mysql_select_db(
"appsklima"
)
or
die
(
"Die Datenbank existiert nicht"
);
$result
= mysql_query(
"SELECT * FROM themes ORDER BY datum ASC"
);
while
(
$row
= mysql_fetch_object(
$result
))
{
$thema
=
$row
->thema;
$inhalt
=
$row
->inhalt;
$author
=
$row
->author;
$datum
=
$row
->datum;
echo
$thema
;
echo
"</br>"
;
echo
$inhalt
;
echo
"</br>"
;
echo
$author
;
echo
"</br>"
;
echo
$datum
;
echo
"</br></br>"
;
}
?>
Beitrag zuletzt geändert: 11.11.2012 21:16:48 von tobiworlds -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage