Steup
12.07.2002, 19:45
So ich habe jetzt ma nen guestbook geschrieben... da sin aber noch inige fehler drinnen... ich meine es fungiert, aber könnte mir jemand den code ein bisschen optimieren und vielleicht auch sagen wieso der keine zeilenumbrüche macht. das nervt mich total...
also hier der code
<?php
mysql_connect("localhost" ,"root","q1w2e3r4");
mysql_select_db("Anderranostanias");
if (($Nname<>"") && ($bla<>"")) {
$fetchx=mysql_query("SELECT * FROM guestbook ORDER BY ind DESC;") or die ("ERROR"); //wenn Sortierung andersrum denn net DESC sondern ASC
$xx= mysql_num_rows($fetchx);
$inde= mysql_fetch_row ($fetchx);
$in= $inde[0];
$iii= $in+1;
$dati=date("d.m.y");
$convText=htmlspecialchars($bla);
$anfrage="INSERT INTO guestbook (ind, name, email,url, icq, Message, datum) VALUES (\"$iii\", \"$Nname\", \"$mail\",\"$UUrl\", \"$icq\", \"$convText\", \"$dati\");";
$res= mysql_query($anfrage);
echo $res;
}
echo "
<html>
<head>
<title>Anderranostanias</title>
<style>
a {text-decoration: none; color:red;}
a:active {text-decoration: underline; color:red;}
a:hover {text-decoration: underline; color:red;}
body {
scrollbar-3d-light-color :white;
scrollbar-arrow-color :white;
scrollbar-base-color:black;
scrollbar-dark-shadow-color :black;
scrollbar-face-color:black;
scrollbar-highlight-color:white;
scrollbar-shadow-color :white;
}
</style>
</head>
<body bgcolor=\"black\" topmargin=\"5\" text=\"white\">
<img src=\"../GFX/title_guestbook.jpg\" border=\"0\">
<form name=\"form1\" method=\"post\" action=\"x_guestbook.php\">
<table width=\"61%\" border=\"0\" align=\"center\">
<tr>
<td width=\"22%\">Name:</td>
<td width=\"24%\">
<input type=\"text\" name=\"Nname\">
</td>
<td rowspan=\"5\" width=\"54%\">
<textarea name=\"bla\" cols=\"32\" rows=\"9\"></textarea>
</td>
</tr>
<tr>
<td width=\"22%\" height=\"24\">E-Mail:</td>
<td width=\"24%\" height=\"24\">
<input type=\"text\" name=\"mail\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"24\">ICQ:</td>
<td width=\"24%\" height=\"24\">
<input type=\"text\" name=\"icq\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"22\">HomePage:</td>
<td width=\"24%\" height=\"22\">
<input type=\"text\" name=\"UUrl\" value=\"http://\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"39\">
<input type=\"submit\" name=\"Submit\" value=\"Mach Rein!\">
</td>
<td width=\"24%\" height=\"39\">
<input type=\"reset\" name=\"reset\" value=\"Mach Weg!\">
</td>
</tr>
</table>
</form>
";
$fetch=mysql_query("SELECT * FROM guestbook ORDER BY ind DESC;") or die ("ERROR"); //wenn Sortierung andersrum denn net DESC sondern ASC
$x= mysql_num_rows($fetch);
echo "";
for ($i=0;$i<$x;$i++){
$afrage=mysql_fetch_row ($fetch);
echo "
<table width=\"90%\" border=\"0\" align=\"center\">
<tr bgcolor=\"#3333333\">
<td>
<table width=\"100%\" border=\"0\">
<tr>
<td width=\"20\">"; echo $afrage[0]; echo "</td>
<td width=\"170\">"; echo $afrage[1]; echo "</td>
<td width=\"20\"><a href=\"mailto:"; echo $afrage[2]; echo "\">";echo "<img src=\"email.gif\" border=\"0\" alt=\"";echo $afrage[2]; echo "\"></a></td>
<td width=\"20\"><a href=\""; echo $afrage[3]; echo "\" target=\"_New\">";echo "<img src=\"homepage.gif\" border=\"0\" alt=\"";echo $afrage[3]; echo "\"></a></td>
<td width=\"90\">ICQ: "; echo $afrage[4]; echo "</td>
<td width=\"30\">"; echo $afrage[6]; echo "</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>"; echo $afrage[5]; echo "</td>
</tr>
</tr>
</table>
<br>";
}
echo"
<BR>
</body>
</html>
";
?>
danke schonma im vorraus für die hilfe... ach ja nich über das lachen was ich da mit dem index gemacht habe.... also... einfach optimieren und das mit den zeilenumbrüchen einbauen und ich ich bin sehr dankbar und zufrieden.
SteuP
also hier der code
<?php
mysql_connect("localhost" ,"root","q1w2e3r4");
mysql_select_db("Anderranostanias");
if (($Nname<>"") && ($bla<>"")) {
$fetchx=mysql_query("SELECT * FROM guestbook ORDER BY ind DESC;") or die ("ERROR"); //wenn Sortierung andersrum denn net DESC sondern ASC
$xx= mysql_num_rows($fetchx);
$inde= mysql_fetch_row ($fetchx);
$in= $inde[0];
$iii= $in+1;
$dati=date("d.m.y");
$convText=htmlspecialchars($bla);
$anfrage="INSERT INTO guestbook (ind, name, email,url, icq, Message, datum) VALUES (\"$iii\", \"$Nname\", \"$mail\",\"$UUrl\", \"$icq\", \"$convText\", \"$dati\");";
$res= mysql_query($anfrage);
echo $res;
}
echo "
<html>
<head>
<title>Anderranostanias</title>
<style>
a {text-decoration: none; color:red;}
a:active {text-decoration: underline; color:red;}
a:hover {text-decoration: underline; color:red;}
body {
scrollbar-3d-light-color :white;
scrollbar-arrow-color :white;
scrollbar-base-color:black;
scrollbar-dark-shadow-color :black;
scrollbar-face-color:black;
scrollbar-highlight-color:white;
scrollbar-shadow-color :white;
}
</style>
</head>
<body bgcolor=\"black\" topmargin=\"5\" text=\"white\">
<img src=\"../GFX/title_guestbook.jpg\" border=\"0\">
<form name=\"form1\" method=\"post\" action=\"x_guestbook.php\">
<table width=\"61%\" border=\"0\" align=\"center\">
<tr>
<td width=\"22%\">Name:</td>
<td width=\"24%\">
<input type=\"text\" name=\"Nname\">
</td>
<td rowspan=\"5\" width=\"54%\">
<textarea name=\"bla\" cols=\"32\" rows=\"9\"></textarea>
</td>
</tr>
<tr>
<td width=\"22%\" height=\"24\">E-Mail:</td>
<td width=\"24%\" height=\"24\">
<input type=\"text\" name=\"mail\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"24\">ICQ:</td>
<td width=\"24%\" height=\"24\">
<input type=\"text\" name=\"icq\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"22\">HomePage:</td>
<td width=\"24%\" height=\"22\">
<input type=\"text\" name=\"UUrl\" value=\"http://\">
</td>
</tr>
<tr>
<td width=\"22%\" height=\"39\">
<input type=\"submit\" name=\"Submit\" value=\"Mach Rein!\">
</td>
<td width=\"24%\" height=\"39\">
<input type=\"reset\" name=\"reset\" value=\"Mach Weg!\">
</td>
</tr>
</table>
</form>
";
$fetch=mysql_query("SELECT * FROM guestbook ORDER BY ind DESC;") or die ("ERROR"); //wenn Sortierung andersrum denn net DESC sondern ASC
$x= mysql_num_rows($fetch);
echo "";
for ($i=0;$i<$x;$i++){
$afrage=mysql_fetch_row ($fetch);
echo "
<table width=\"90%\" border=\"0\" align=\"center\">
<tr bgcolor=\"#3333333\">
<td>
<table width=\"100%\" border=\"0\">
<tr>
<td width=\"20\">"; echo $afrage[0]; echo "</td>
<td width=\"170\">"; echo $afrage[1]; echo "</td>
<td width=\"20\"><a href=\"mailto:"; echo $afrage[2]; echo "\">";echo "<img src=\"email.gif\" border=\"0\" alt=\"";echo $afrage[2]; echo "\"></a></td>
<td width=\"20\"><a href=\""; echo $afrage[3]; echo "\" target=\"_New\">";echo "<img src=\"homepage.gif\" border=\"0\" alt=\"";echo $afrage[3]; echo "\"></a></td>
<td width=\"90\">ICQ: "; echo $afrage[4]; echo "</td>
<td width=\"30\">"; echo $afrage[6]; echo "</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>"; echo $afrage[5]; echo "</td>
</tr>
</tr>
</table>
<br>";
}
echo"
<BR>
</body>
</html>
";
?>
danke schonma im vorraus für die hilfe... ach ja nich über das lachen was ich da mit dem index gemacht habe.... also... einfach optimieren und das mit den zeilenumbrüchen einbauen und ich ich bin sehr dankbar und zufrieden.
SteuP