View Full Version : Rich text editor - loading database text with php

07-15-2007, 06:22 AM
1) Script Title: Rich Text Editor (for textareas)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm

3) Describe problem: I am wondering if it is possible to load text that is in a mysql database with PHP into the text box? Thanks in advance.

07-15-2007, 04:08 PM
You can, and all you have to do is like so:

$id = $_GET['id'];

include('dbconnect.php'); //all the database info and connection

$info = mysql_query("SELECT * FROM `table` WHERE `id`='$id'");

while ($q = mysql_fetch_array($info)) {

<script language="JavaScript" type="text/javascript">
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', '<?php echo htmlentities($q["content"]);?>', 400, 200, true, false);


Just an example of course, but you get the idea. Hope this helps.