for ik så lang tid siden skrev jeg et spørgsmål og et add script. nu har jeg modifceret det så det passer til min hp.
men problemet er at den kun viser det nyeste indlæg! jeg har ik lavet nogen limit eller noget.
koden:
<html>
<head>
<title>:: CONTUSE ::</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body text="#000000" bgcolor="#3B3C3C" topmargin="0">
<?php
mysql_connect("localhost", "**", "***");
mysql_select_db("***");
$mode = $_GET["mode"];
if ($mode == "show_match") {
$id = $_GET["id"];
$result = mysql_query("SELECT id, modstander, result, type, date, lineup, mlineup, report, ss, demo FROM cw WHERE id = '$id'");
if ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$modstander = $row["modstander"];
$result = $row["result"];
$type = $row["type"];
$date = $row["date"];
$lineup = $row["lineup"];
$mlineup = $row["mlineup"];
$report = $row["report"];
$ss = $row["ss"];
$demo = $row["demo"];
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='340' height='20'>";
echo "<tr>";
echo "<td bgcolor='A56A03'><b><font class='overskrift'>contuse vs $modstander</font></b></td>";
echo "</tr>";
echo "<tr><td><br></td></tr>";
echo "</table>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='340' height='20'>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrift'>.date</font></b></td>";
echo "<td>$date</td>";
echo "</tr valign='top'>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrift'>.result</font></b></td>";
echo "<td valign='top' width='190'>$result</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrift'>.screenshots</font></b></td>";
echo "<td valign='top' width='190'>$ss</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrif'>.demo</font></b></td>";
echo "<td valign='top' width='190'>$demo</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrift'>.lineup</font></b></td>";
echo "<td valign='top' width='190'>$lineup</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='150'><b><font class='overskrift'>.$modstander lineup</font></b><br><br></td>";
echo "<td valign='top' width='190'>$mlineup</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='150' width='190'><b><font class='overskrift'>.report</font></b></td>";
echo "</tr>";
echo "</table>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='340' height='20'>";
echo "<tr>";
echo "<td valign='top' width='340'>$report</td>";
echo "</tr>";
echo "</table>";
echo "<br><br>";
echo "<a href='matches.php?mode=show_all'>Back</a>";
}
}
?>
<?php
if ($mode == "show_all") {
$result = mysql_query("SELECT id, modstander, result, type FROM cw");
while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$modstander = $row["modstander"];
$result = $row["result"];
$type = $row["type"];
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='340' height='20'>";
echo "<tr>";
echo "<td bgcolor='A56A03' width='100'><font class='overskrift'>.vs</td>";
echo "<td bgcolor='A56A03' width='100'><font class='overskrift'>.type</td>";
echo "<td bgcolor='A56A03' width='100'><font class='overskrift'>.result</td>";
echo "<td bgcolor='A56A03' width='20'><font class='overskrift'>.report</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100' height='10'></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100'><font class='overskrift'>$modstander</td>";
echo "<td width='100'><font class='overskrift'>$type</td>";
echo "<td width='100'><font class='overskrift'>$result</td>";
echo "<td width='20'><font class='overskrift'><a href='$PHP_SELF?mode=show_match&id=$id'><img alt='report_icon.gif (1K)' src='images/report_icon.gif' height='14' width='10' border='0'></a></td><br>";
echo "</tr>";
echo "</table>";
}
}
?>
</body>
</html>
og mysql:
CREATE TABLE cw (
id int(11) NOT NULL auto_increment,
modstander varchar(50) NOT NULL default '',
result varchar(10) NOT NULL default '',
type varchar(15) NOT NULL default '',
date varchar(15) NOT NULL default '',
lineup varchar(100) NOT NULL default '',
mlineup varchar(100) NOT NULL default '',
ss varchar(100) NOT NULL default '',
demo varchar(100) NOT NULL default '',
report text NOT NULL,
PRIMARY KEY (id)
)
problemet var altså at den kun skriver det nyeste indlæg ud.
håber der er en der kan finde fejlen
.MortenJ