Forum Moderators: coopster

Message Too Old, No Replies

Returning info from MySql

data from mysql

         

tmaple

11:38 pm on Jul 17, 2007 (gmt 0)

10+ Year Member



Hello everyone,

I am new to php and am having some issues displaying data from mysql database. I only return a value of "Array" it should return a string that I have entered manually in MySql.

I am missing something somewhere. Any help would be greatly appreciated.

<?php require_once('Connections/Editor.php');?>
<?php
mysql_select_db("thyme", $Editor);
$query_Editor = "SELECT text FROM thyme_editor";
$Editor = mysql_query($query_Editor) or die(mysql_error());
$row_Editor = mysql_fetch_array($Editor);

include("FCKeditor/fckeditor.php");

$text="$row_Editor"
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="800" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3"><form id="form1" name="form1" method="post" action="display.php">

<?php
$oFCKeditor = new FCKeditor('FCKeditor1');
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Value = "$text";
$oFCKeditor->Create();
?>
<input name="btnsubmit" type="submit" value="Publish Web Page" />

</form>
<tr>
<td>&nbsp;</td>
<td><?php echo $row_Editor;?></td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Editor);
?>

StudioKraft

3:48 am on Jul 18, 2007 (gmt 0)

10+ Year Member



Hello,

Changing the line:

$text="$row_Editor"

To:

$text=$row_Editor['text'];

Should do the trick. Results from MySQL queries fetched using the "mysql_fetch_array" function are always returned as arrays, even if only one field/value is being returned.

Hope this helps,

SK