PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   PHP Grundlagen (http://www.selfphp.de/forum/forumdisplay.php?f=12)
-   -   Eigenes CMS - MySQL Problem (http://www.selfphp.de/forum/showthread.php?t=10586)

Tedd 24.05.2005 18:10:47

Eigenes CMS - MySQL Problem
 
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';
}
?>


|Coding 24.05.2005 18:18:16

AW: Eigenes CMS - MySQL Problem
 
Versuch es mal hiermit:
PHP-Code:

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';


oder mit einer besseren Fehlerbeschreibung.

Tedd 25.05.2005 16:41:51

AW: Eigenes CMS - MySQL Problem
 
Ich hab grad den Fehler gefunden :D.
Nähmlich war das limit = 0 und muss ja min. 1 sein.
Danke für eure Hilfe!


Alle Zeitangaben in WEZ +2. Es ist jetzt 00:12:50 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.