Ok, old post but this may help someone. this is a simplified down and dirty way of doing this. It assumes that you can create a table and insert some 'Lorem Ipsum' or other temp copy to begin with and update as needed.
CREATE TABLE `about` ( `id` int(11) NOT NULL auto_increment, `copyOne` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
1. First connect to the database. I store this with the scripts to recall and update in an includes folder.
2.Select current data from the table. This example table has only id and copyOne, it also requests an undefined variable which we will create in our editor. That is done for the following reason, if you use multiple tables with the same two fields, you can call the same script from several pages and updeate them accordingly.
<!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="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Edit Oppertunity</h1>
<div id="formArea">
<form action= "includes/update.php" method="post">
<?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('name') ;
$oFCKeditor->BasePath = $sBasePath ;
require_once('includes/sql.php');
$oFCKeditor->Value = $copyOne ;
$oFCKeditor->Create() ;
?>
<br>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="tableName" value="<?php echo $tableName; ?>">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
4.Now it's back to the includes folder for our update script which will post the changes to the sql file.
/*includes/update.php*/
<?php
require_once('connect.php');
if(isset($_POST)){
$copy= $_POST[name];
/*$copy= str_replace("'", "\'", $copy);*/
$id=$_POST[id];
$tableName=$_POST[tableName];
}
$sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'";
$result=$mysqli->query($sql);
if($result){
echo $copy;
} else {
echo mysqli_error($mysqli) . '<br>' . "\n";
echo $copy;
echo $tableName;
}
?>
Ok, old post but this may help someone. this is a simplified down and dirty way of doing this. It assumes that you can create a table and insert some 'Lorem Ipsum' or other temp copy to begin with and update as needed.
CREATE TABLE `about` ( `id` int(11) NOT NULL auto_increment, `copyOne` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
1. First connect to the database. I store this with the scripts to recall and update in an includes folder.
2.Select current data from the table. This example table has only id and copyOne, it also requests an undefined variable which we will create in our editor. That is done for the following reason, if you use multiple tables with the same two fields, you can call the same script from several pages and updeate them accordingly.
<!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="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Edit Oppertunity</h1>
<div id="formArea">
<form action= "includes/update.php" method="post">
<?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('name') ;
$oFCKeditor->BasePath = $sBasePath ;
require_once('includes/sql.php');
$oFCKeditor->Value = $copyOne ;
$oFCKeditor->Create() ;
?>
<br>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="tableName" value="<?php echo $tableName; ?>">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
4.Now it's back to the includes folder for our update script which will post the changes to the sql file.
/*includes/update.php*/
<?php
require_once('connect.php');
if(isset($_POST)){
$copy= $_POST[name];
/*$copy= str_replace("'", "\'", $copy);*/
$id=$_POST[id];
$tableName=$_POST[tableName];
}
$sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'";
$result=$mysqli->query($sql);
if($result){
echo $copy;
} else {
echo mysqli_error($mysqli) . '<br>' . "\n";
echo $copy;
echo $tableName;
}
?>
RE: save in mysql Database?
I solved it like this:
1. in the file containing your editor make a form-tag something like this:
2. in submit.php:
Of course you have to set the variables ($server, $user ...) to your settings.
carl.
RE: save in mysql Database?
Ok, old post but this may help someone. this is a simplified down and dirty way of doing this. It assumes that you can create a table and insert some 'Lorem Ipsum' or other temp copy to begin with and update as needed.
CREATE TABLE `about` (
`id` int(11) NOT NULL auto_increment,
`copyOne` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
1. First connect to the database. I store this with the scripts to recall and update in an includes folder.
/*includes/connect.php*/
2.Select current data from the table. This example table has only id and copyOne, it also requests an undefined variable which we will create in our editor.
That is done for the following reason, if you use multiple tables with the same two fields, you can call the same script from several pages and updeate them accordingly.
/*includes/sql.php*/
3.Now we add the almost unchanged FCKeditor sample page(this is where we include the sql file and declare the variable noted earlier.)
/*about.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="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Edit Oppertunity</h1> <div id="formArea"> <form action= "includes/update.php" method="post"> <?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('name') ; $oFCKeditor->BasePath = $sBasePath ; require_once('includes/sql.php'); $oFCKeditor->Value = $copyOne ; $oFCKeditor->Create() ; ?> <br> <input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="hidden" name="tableName" value="<?php echo $tableName; ?>"> <input type="submit" value="Submit"> </form> </div> </body> </html>
4.Now it's back to the includes folder for our update script which will post the changes to the sql file. /*includes/update.php*/ <?php require_once('connect.php'); if(isset($_POST)){ $copy= $_POST[name]; /*$copy= str_replace("'", "\'", $copy);*/ $id=$_POST[id]; $tableName=$_POST[tableName]; } $sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'"; $result=$mysqli->query($sql); if($result){ echo $copy; } else { echo mysqli_error($mysqli) . '<br>' . "\n"; echo $copy; echo $tableName; } ?>
RE: save in mysql Database?
I solved it like this:
1. in the file containing your editor make a form-tag something like this:
2. in submit.php:
Of course you have to set the variables ($server, $user ...) to your settings.
carl.
RE: save in mysql Database?
Ok, old post but this may help someone. this is a simplified down and dirty way of doing this. It assumes that you can create a table and insert some 'Lorem Ipsum' or other temp copy to begin with and update as needed.
CREATE TABLE `about` (
`id` int(11) NOT NULL auto_increment,
`copyOne` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
1. First connect to the database. I store this with the scripts to recall and update in an includes folder.
/*includes/connect.php*/
2.Select current data from the table. This example table has only id and copyOne, it also requests an undefined variable which we will create in our editor.
That is done for the following reason, if you use multiple tables with the same two fields, you can call the same script from several pages and updeate them accordingly.
/*includes/sql.php*/
3.Now we add the almost unchanged FCKeditor sample page(this is where we include the sql file and declare the variable noted earlier.)
/*about.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="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Edit Oppertunity</h1> <div id="formArea"> <form action= "includes/update.php" method="post"> <?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('name') ; $oFCKeditor->BasePath = $sBasePath ; require_once('includes/sql.php'); $oFCKeditor->Value = $copyOne ; $oFCKeditor->Create() ; ?> <br> <input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="hidden" name="tableName" value="<?php echo $tableName; ?>"> <input type="submit" value="Submit"> </form> </div> </body> </html>
4.Now it's back to the includes folder for our update script which will post the changes to the sql file. /*includes/update.php*/ <?php require_once('connect.php'); if(isset($_POST)){ $copy= $_POST[name]; /*$copy= str_replace("'", "\'", $copy);*/ $id=$_POST[id]; $tableName=$_POST[tableName]; } $sql="UPDATE $tableName SET copyOne ='$copy' WHERE id='$id'"; $result=$mysqli->query($sql); if($result){ echo $copy; } else { echo mysqli_error($mysqli) . '<br>' . "\n"; echo $copy; echo $tableName; } ?>
RE: save in mysql Database?
try my ajaxPost plugin
personal page and demo for the plugin: http://www.saulmade.nl/FCKeditor/FCKPlugins.php
plugin and download page at sourceforge: http://sourceforge.net/tracker/index.ph ... tid=737639
forumThread: http://sourceforge.net/forum/forum.php? ... _id=257179
Re: RE: save in mysql Database?
would you have something similar for saving files/images into a mysql db?