so
CREATE TABLE news (
ID SMALLINT AUTO_INCREMENT PRIMARY KEY,
Kategorie VARCHAR(20),
Autor VARCHAR(20),
Titel VARCHAR(100),
Inhalt TEXT,
Datum VARCHAR(11)
);
und hier noch das nächste
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><div align="center">
<div align="center"><a href="news_add.php"><font size="1"face="Verdana">News Schreiben</font></a>
• <a href="index.php?page=news&pn=edit"><font size="1"face="Verdana">User
Verwaltung</font></a> • <a href="index.php?page=news"><font size="1"face="Verdana">Daten
Editieren</font></a> </div>
<div align="center"> <center> </div>
<br>
<?PHP
$mysql = mysql_connect('localhost', 'root', '' or die(mysql_error());
mysql_select_db('projects', $mysql) or die(mysql_error());
if (array_key_exists('delete',$_GET)) {
$deleteid = (int) $_GET['delete'];
$sql = "DELETE FROM news WHERE ID = '".$_GET['delete']."'";
$query = mysql_query($sql) OR die(mysql_error());
echo 'Ihr Datensatz wurde erfolgreich gelöscht.';
exit;
}
if (isset($_GET['edit']) && !empty($_GET['edit']) && is_numeric($_GET['edit'])){
$sql = "SELECT * FROM news WHERE ID = '".$_GET['edit']."'";
$query = mysql_query($sql) OR die(mysql_error());
$ds = mysql_fetch_object($query);
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#000">
<tr>
<td colspan="2" bgcolor="#AAA" align="center"><font color="#FFFFFF"><b>News
Bearbeiten </b></font></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCC"><font color="#FFFFFF">von <?echo($ds->Autor);?></font></td>
</tr>
<tr>
<td width="287" bgcolor="#CCC"><font color="#FFFFFF">Titel</font></td>
<td width="198" bgcolor="#C0C0C0"><font color="#FFFFFF">
<input name="email" type="text" style="font-family: Verdana; font-size: 11px;" value="<?echo($ds->Titel);?>" size="33" />
</font></td>
</tr>
<tr>
<td bgcolor="#CCC"><font color="#FFFFFF">News</font></td>
<td bgcolor="#C0C0C0"><font color="#FFFFFF">
<input name="Passwort" type="text" style="font-family: Verdana; font-size: 11px;" value="<?echo($ds->Inhalt);?>" size="33" />
</font></td>
</tr>
<tr>
<td bgcolor="#CCC"><font color="#FFFFFF">Kategorie</font></td>
<td bgcolor="#C0C0C0"><font color="#FFFFFF">
<input name="links2" type="text" style="font-family: Verdana; font-size: 11px;" value="<?echo($ds->kat);?>" size="33" />
</font></td>
</tr>
<tr>
<td bgcolor="#CCC"><font color="#FFFFFF">Links</font></td>
<td bgcolor="#C0C0C0"><font color="#FFFFFF">
<input name="links" type="text" style="font-family: Verdana; font-size: 11px;" value="<?echo($ds->links);?>" size="33" />
</font></td>
</tr>
<tr>
<td height="49" colspan="2" valign="top" bgcolor="#CCC"> <font color="#FFFFFF">
</font>
<div align="center"><font color="#FFFFFF">
<input name="speichern" type="submit" value="Speichern">
<input type="hidden" name="id" value="<? echo ($ds->ID); ?>">
</font> </div>
</td>
</tr>
</table>
<?
exit;
}
if (isset($_POST['speichern'])){
$sql = "UPDATE `news` SET `ID` = '',
`Kategorie` = '".addslashes($_POST['kat'])."',
`Autor` = '".addslashes($_POST['name'])."',
`Titel` = '".addslashes($_POST['titel'])."',
`Inhalt` = '".addslashes($_POST['news'])."',
`Datum` = '".time()."'
";
$query = mysql_query($sql) OR die(mysql_error());
echo 'Ihr Datensatz wurde erfolgreich gespeichert.';
exit;
}
$sql = 'SELECT * FROM news ORDER BY `ID` DESC ';
$query = mysql_query($sql) OR die(mysql_error());
if (!mysql_num_rows($query) > 0){
echo 'Keine Einträge vorhanden.';
exit;
} else {
echo '<table border="1" bordercolor="#000000" style="border-collapse: collapse">';
$cntquery = mysql_query('SELECT COUNT(*) cnt FROM news';
$row = mysql_fetch_assoc($cntquery);
$count = $row['cnt']+1;
?>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber1">
<tr bgcolor="#E1F0F4">
<td colspan="3"><font size="2"face="Verdana"><b>News Titel</b></font></td>
<td width="50%"><font size="2"> </font></td>
<td width="13%"><font size="2"face="Verdana"> </font></td>
<td width="9%"> <center>
<font size="2" face="Verdana"><b> Bearbeiten </b></font></center></td>
<td width="6%"> <center>
<font size="2" face="Verdana"><b> Löschen </b></font></center></td>
<td width="14%"> <center>
<font size="2" face="Verdana"><b> Feedback </b></font></center></td>
</tr>
<?php
while ($ds = mysql_fetch_object($query)){
--$count;
$timestamp = $ds->Datum;
$datum = date("d.m.Y",$timestamp);
$uhrzeit = date("H:i",$timestamp);
?>
<tr bgcolor="#FFFFFF">
<td width="3%"><b><font color="#000000" size="2">Nr<em><?php echo($count);?></em></font></b></td>
<td width="1%"><em><?php echo($ds->Autor);?></em></td>
<td width="4%"><b><font color="#000000" size="2"><em><?php echo(substr($ds->Titel, 0, 50))?></em></font></b></td>
<td width="50%"><b><em><?php echo(substr($ds->Inhalt, 0, 50))?>...</em></b></td>
<td><font color="#000000" size="2"><b>vom <?php echo $datum,"-",$uhrzeit,"Uhr"; ?>
</b></font></td>
<td width="9%"> <center>
<font color="#000000" size="2" face="Verdana"><a href="?edit=<? echo $ds->ID; ?>">X</a>
</font>
</center></td>
<td width="6%"> <center>
<font color="#000000" size="2"><a href="?delete=<? echo $ds->ID; ?>">X</a>
</font>
</center></td>
<td width="14%"> <center>
<font color="#000000" size="2"><?php
echo"<a href=\"kommentar.php?edit=$ds->ID\">Kommentare bearbeiten</a>";
?>
</td>
</tr>
<?
}
echo '</table>';
}
?>
ich hoffe damit kannste was anfangen
OS: Windows XP
CPU: AMD Athlon XP 3200+
RAM: 512MB DDR PC3200 (Dual Channel)
Mainboard: MSI K7n2 Delta-L
HDD: 80GB WD
Graka:Radeon 9600 Pro
=>
Alekeijer Straussbuwe