I am a writer. All I want to do is use a RichTextEditor in Flex 2 as a text editor. Only I want to save and open not to and from the hard drive but a server database.
My PHP is pretty close. Is there anyone can help with the rest of the scripting, the ActionScript running within Flex 2?
I really would be thankful if possible.
Here is my PHP. I want to INSERT, UPDATE and RETRIEVE.
textTB = table
textCL = one column
infoCL = second column
$txt = one text variable
$nfo = second text variable
<?php
// I have the server connection;
// I have the database connection;
INSERT:
// I’m not sure about these include libraries.
include 'library/config.php';
include 'library/opendb.php';
// I have the server connection;
// I have the database connection;
$query = "INSERT INTO textTB ( textCL, infoCL ) VALUES ( '$txt', '$nfo' )";
$mysql_query( $query, $link ) or die ( "INSERT error: ".mysql_error() );
// I’m not sure of this closing code.
include 'library/closedb.php';
mysql_close( $link );
?>
UPDATE:
<?php
include 'library/config.php';
include 'library/opendb.php';
// server connection;
// database connection;
$query = "UPDATE textTB SET textCL='$txt', infoCL='$nfo' WHERE textID=1";
mysql_query($query) or die('Error, query failed');
include 'library/closedb.php';
mysql_close( $link );
?>
RETRIEVE:
<?php
include 'library/config.php';
include 'library/opendb.php';
// server connection;
// database connection;
$result = mysql_query("SELECT textCL, infoCL FROM textTB WHERE textID=1");
list($txt, $nfo) = mysql_fetch_assoc($result);
include 'library/closedb.php';
mysql_close( $link );
?>
Thanks,
JL