Hi,
folgendes.
Ich habe hier einen Webeditor [FCKeditor]. In dem lese ich aus einer Datenbank aus damit im editierfeld des Editors dann das aus der Datenbank steht. Das ganze sieht wie folgt aus.
PHP-Code:
<?php
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* [url]http://www.opensource.org/licenses/lgpl-license.php[/url]
*
* For further information visit:
* [url]http://www.fckeditor.net/[/url]
*
* File Name: sample04.php
* Sample page.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
include("../../fckeditor.php") ;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function FCKeditor_OnComplete( editorInstance )
{
var oCombo = document.getElementById( 'cmbSkins' ) ;
// Get the active skin.
var sSkin = editorInstance.Config['SkinPath'] ;
sSkin = sSkin.match( /[^\/]+(?=\/$)/g ) ;
oCombo.value = sSkin ;
oCombo.style.visibility = '' ;
}
function ChangeSkin( skinName )
{
window.location.href = window.location.pathname + "?Skin=" + skinName ;
}
</script>
</head>
<body>
<h1>FCKeditor - PHP - Sample 4</h1>
This sample shows how to change the editor skin.
<hr>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
Select the skin to load:
</td>
<td>
<select id="cmbSkins" onchange="ChangeSkin(this.value);" style="VISIBILITY: hidden">
<option value="default" selected>Default</option>
<option value="office2003">Office 2003</option>
<option value="silver">Silver</option>
</select>
</td>
</tr>
</table>
<form action="add.php" method="post" target="_blank">
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value.
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = $sBasePath ;
if ( isset($_GET['Skin']) )
$oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/' . $_GET['Skin'] . '/' ;
mysql_connect("192.168.1.250","root",""); // Adresse zur MySQL Datenbank, Benutzername und Passwort
mysql_select_db("test"); // Datenbank-Name
$sql = "SELECT rubrik FROM rubrik";
$result = mysql_query($sql) OR die(mysql_error());
while($row = mysql_fetch_array($result))
{
$oFCKeditor->Value = $row['rubrik'] ;
}
$oFCKeditor->Create() ;
?>
<input type="image" src="../anmeldung/button_send_de.gif" name="submit" value="AB">
</form>
</body>
</html>
?>
fast ganz unten in dem script könnt ihr die abfrage sehen. Hier mein erstes Problem. In der Datenbank Test ->gibts eine Tabelle rubrik-> und in der Tabelle eine Spalte rubrik. In der Spalte rubrik sind 5 einträge. Beim auslesen in das Editierfeld wird mir immer nur der letzte Eintrag angezeigt der darin steht. Warum?? was mache ich da falsch???
So nun zum update. Das ganze wie man oben sieht wird mit der <form> geregelt und somit kann ich daten an die Datei add.php welche das Update durchführen soll schicken. Diese Datei sieht wie folgt aus:
PHP-Code:
<?php
//$content = $_GET["news_content"];
//echo "$content
";
print_r($_POST['FCKeditor1']); //hier sehe ich das was er aus dem editierfeld mitgegeben hat
mysql_connect("192.168.1.250", "root", "");
mysql_select_db("test",$q);
$q = "UPDATE `rubrik` SET `rubrik`= '$_POST[FCKeditor1]'";
mysql_query($q);
?>
So das Problem er Updatet nichts.
Desweiteren bringt der immer die meldung.
aber ich glaube das liegt nur an dem IIS weil die error reportings an sind oder???
Code:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:\inetpub\wwwroot\FCKeditor_2.0\_samples\php\add.php on line 11
Währe für jede Hilfe dankbar