Hi.
I know there have been many many thread's about this topic, but I'm afraid none of the once I've found have helped me. (I'm using PHP 5 on a Apache server.)
The editor work fine, so does the load from the database into a page. BUT when combining these two - that is when trying to load the data to the editor-field, I get no result. (the editor showes but nothing is loaded)
I gues my problem is that i use the wrong value?
How to solve this?
My code is as follows:
I'm almoust desperate and I would appreciate any help very very much.
Thanks in advance.
Marcus Nordgren
I know there have been many many thread's about this topic, but I'm afraid none of the once I've found have helped me. (I'm using PHP 5 on a Apache server.)
The editor work fine, so does the load from the database into a page. BUT when combining these two - that is when trying to load the data to the editor-field, I get no result. (the editor showes but nothing is loaded)
I gues my problem is that i use the wrong value?
How to solve this?
My code is as follows:
<?php include("../../fckeditor.php") ; include("db.php"); ?>
<html>
<head>
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Välkommen till redigeringssidan.</h1>Använd nedanstående formulär precis som du använder Word. <hr>
<form action="sampleposteddata.php" method="post" target="_blank">
<?PHP
$hamta_text = "SELECT text FROM page_get where id='22'";
$visa_text = mysql_query($hamta_text);
while($rad = mysql_fetch_array($visa_text, MYSQL_ASSOC))
{ echo "{$rad['text']}"; }
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '/edit/';
$oFCKeditor->Value = "".$rad['text']."";
$oFCKeditor->Height = 500;
$oFCKeditor->Create() ;
mysql_free_result($visa_text);
?>
<br>
<input type="submit" value="Spara">
</form>
</body>
</html>
I'm almoust desperate and I would appreciate any help very very much.
Thanks in advance.
Marcus Nordgren
RE: Load editor with data from MySQL database
<?PHP $hamta_text = "SELECT text FROM page_get where id='22'"; $visa_text = mysql_query($hamta_text); //--> Use IF statement instead of WHILE if($rad = mysql_fetch_array($visa_text, MYSQL_ASSOC)) //---> Using the print_r command will output the whole array { print_r($rad['text']); } $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/edit/'; //---> There is no need to surround the array varaible with quotes. $oFCKeditor->Value = $rad['text']; $oFCKeditor->Height = 500; $oFCKeditor->Create() ; mysql_free_result($visa_text); ?>
RE: Load editor with data from MySQL database.
Thank u, you are my hero! (No kidding)
Can't understand why i didn't thought of this myself but now everything is running great.
Gues next problem will be to store the edited data in the base, but I'll give it a go by myself.
If there are anything i can help u with, it would be my pleasure!
Best regard
Marcus