This is easy to accomplish, so let's see an example. Firstly, create a database with one table:
create database myDatabase;
use myDatabase;
create table myTable
(
keyId int auto_increment,
content text,
primary key(keyId),
unique id(keyId)
);
Next, create a test record:
insert into myTable values(0, '<b>this is some text!</b>');
Now, the PHP code (you should change the database details to match your MySQL setup):
<?php
include("de/class.devedit.php");
$myDE = new DevEdit;
SetDevEditPath("/de");
$myDE->SetName("myDevEditControl");
// Connect to the database
$dbServer = "localhost";
$dbUser = "admin";
$dbPass = "password";
$dbName = "myDatabase";
$c = mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldn't connect to database");
$d = mysql_select_db($dbName) or die("Couldn't select database");
if(@$_POST["save"] == "true")
{
$content = $myDE->GetValue(true);
$result = @mysql_query("update myTable set content = '$content' where keyId = 1");
echo "Content.php saved!<br><br><a href='test.php'>Continue</a>";
}
else
{
$result = mysql_query("select content from myTable where keyId = 1");
if($row = mysql_fetch_array($result))
$data = $row["content"];
else
$data = "";
$myDE->SetValue($data);
?>
<form action="test.php" method="post">
<input type="hidden" name="save" value="true">
<?php $myDE->ShowControl(400, 300, "my_image_dir"); ?>
<input type="submit" value="Save">
</form>
<?php
}
?>
Note: This is an example. You may have to change parts of the code above to get it to work.
