i am trying to recall data from my a database which someone else has set up. the site is a contnet management system and it uses innovaStudio which is a wysiwyg to do all the editing for the text on the website. the editor side of it works where it will load the text into the text area and the changes can be made to. from here there is then a save function which submits the body text from the form.
the save function looks like this
function save()
{
document.forms.form1.elements.inpContent.value = oEdit1.getHTMLBody();
document.forms.form1.submit()
}
the code which i think is not working is the saving the data back to the database as when i try to recall the information on a different page i get no connection errors but i do not get anything displaying.
the code he has used for the saving of the data back to the database is
if(isset($_POST["inpContent"]))
{
$sContent=stripslashes($_POST['inpContent']); // remove slashes (/)
$sContent=ereg_replace("'","''",$sContent); // fix SQL
$sql="UPDATE cms_core SET editorial='$sContent' WHERE id=$id";
$query = mysql_query($sql);
}
he has put code in for loading the text into the editor which looks like this
if(!$_GET["id"]){ $id = 1; }
$sql = "SELECT * FROM cms_core WHERE id=$id";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
$sContent = $result['editorial'];
it uses some code to load temporarily hold the data before loading it into the editor and the code for this is
<pre id="idTemporary" name="idTemporary" style="display:none">
<? echo htmlentities($sContent); ?>
</pre>
the code i have used to display the data is
<?php
// get the data from the database
if(!$_GET["id"]){ $id = 1; }
$sql = "SELECT * FROM cms_core WHERE id=$id";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
?>