Hallo :D!
Also ich wollte mir ein eigenes kleines CMS Programieren aber ich komme jetzt auf einmal nicht mehr weiter. Und zwar liegt das Problem beim Script wo man einen Inhalt ändert. Wenn ich nun etwas ändere gibt MySQL true zurück, aber der inhalt ist immer noch nicht anders. Ich habe den code schon ein paar mal überprüft, finde den Fehler aber nicht. Ich hoffe ihr könnt mir helfen.
PHP-Code:
// mysql_connect.php
<?php
$host = "localhost"; //MySQL Host (standard: localhost)
$user = "root"; //MySQL User
$password = ""; // MySQL Passwort
$database = "cms"; // MySQL Datenban
$tablep = "tcms_"; // Tabellen Präfix
$connection=mysql_connect($host, $user, $password);
mysql_select_db($database, $connection);
?>
PHP-Code:
// Change.php
<?php
$id = $_GET['id'];
include 'mysql_connect.php';
$sql = "SELECT * FROM ".$tablep."menu where `id` = '".$id."' ";
$id_query = mysql_query($sql);
$ida = mysql_fetch_array($id_query);
include 'admin_header.inc.php';
echo "<form action='change1.php?id=".$id."&' method='post'><table>
<tr>
<td>ID:</td><td><input type='text' value='".$ida['id']."' readonly name='id'></td>
</tr>
<tr>
<td>Überschrift</td><td><input type='text' value='".$ida['name']."' name='name'></td>
</tr>
<td>Inhalt</td><td><textarea width='400px' height='400px' name='inhalt'>".$ida['inhalt']."</textarea></td>
</tr>
<tr>
<td><input type='submit' value='Speichern'></td>
</tr></table></form>";
echo "".mysql_error()."";
include 'admin_footer.inc.php';
?>
PHP-Code:
// Change1.php
<?php
$inhalt = $_POST['inhalt'];
$name = $_POST['name'];
$id = $_POST['id'];
include 'mysql_connect.php';
$sql = "SELECT * FROM ".$tablep."menu LIMIT 0 , 30";
$menu_query = mysql_query($sql);
$sql1 = "UPDATE `".$tablep."menu` SET `name` = '".$name."',
`inhalt` = '".$inhalt."' WHERE `id` = '".$id."' LIMIT 0";
$result=mysql_query($sql1);
if($result == "true") {
include 'admin_header.inc.php';
echo "Nachricht wurde erfolgreich geändert!<br><a href='./'>Zur Webseite</a> <a href='./admin.php'>Zum Adminpanel</a>";
include 'admin_footer.inc.php';
} else {
include 'admin_header.inc.php';
echo "Hoppla Hopp!<br><font color='yellow' size='4'>".mysql_error()."</font>";
include 'admin_footer.inc.php';
}
?>