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

    You have to be more specific. I see you have several functions that use Jason Pell's OpenDB. Where are you having problems?

    You mentioned you intend to use a rich text editor that runs in the Flex framework, if you intend to integrate that framework with php you must either use xml to pass data or a gateway such as amfphp or sabre. The amfphp gateway works only with php classes, so your php code needs to be object oriented. This is a very advanced use of php, not really suited to someone new to the language.

      Write a Reply...