JamesCliff
Programmer
Hi,
Im using the following script to edit rows in my database:
It works fine in terms of editing small amounts of information from the database table. However when i enter alot of information eg. a couple of paragraphs i get the error returned "We are experiencing technical difficulties. Unable to update this record." This means the query isnt working. When i enter small amounts of data into the edit field and update it works fine and its all changed.
The mysql field is set to full text and there is no limit to what can be added to the field. I logged into phpmyadmin and copied the content i was trying to add through the script into the field and it saved it to the database no probem.
Does anyone know what could be causing the script query to fail with large amounts of information been entered into it?
Thanks alot
Jim
Im using the following script to edit rows in my database:
Code:
<?php
require_once("config/db.php");
include("FCKeditor/fckeditor.php") ;
$connection = mysql_connect($host, $user, $pass) or die ("Unable to
connect!");
mysql_select_db($db) or die ("Unable to select database!");
$id = $_GET['id'];
// select database
mysql_select_db($db) or die ("Unable to select database!");
$sql = "select id, config_value from brisk_config where id = '$id'";
$result = mysql_query($sql);
if ($result) {
$rec = mysql_fetch_assoc($result);
$out = $rec["config_value"];
$output = stripslashes($out);
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'?page=admin/login/hom3d7r/content/home/home_welcome_mess&mode=e&id='.$rec['id'].'">';
echo '<table width="100%" cellpadding="5" border="0">';
echo "<tr><td>";
$oFCKeditor = new FCKeditor('config_value') ;
$oFCKeditor->BasePath = 'FCKeditor/';
$oFCKeditor->Value = '' . $output .'';
$oFCKeditor->Width = '80%' ;
$oFCKeditor->Height = '300' ;
$oFCKeditor->Create() ;
echo "</td></tr>";
echo '<tr>
<td colspan="1"> </td>
</tr>';
echo '<tr>
<td colspan="1" align="center"><input name="save" type="submit" value="Update Home Page Content"/></td>
</tr>
</table>';
} else {
echo '<p>Nothing found in the database.</p>';
}
if ($_GET['mode']) { // Check to see if mode has been set
$message = NULL;
$mode = $_GET['mode']; //Store mode in a variable
switch ($mode)
{ // begin switch mode
case 'l' : display_list(); // display a list of records
break;
case 'e' : if (isset($_GET['id'])) { // Make sure id is set
$id = $_GET['id']; // Store ID into a variable.
if (isset($_POST['save'])) { // save button was clicked
//Validate the data in your form here.
//Set your select statement based on the data in your form.
$c = stripslashes($_POST['config_value']); // should be $_POST['context'] variables and array keys are case sensitive.
$sql = "Update brisk_config Set config_value='$c' Where id='$id'"; //enclose everything in quotes for good measure.
$result = mysql_query($sql);
if ($result) { // update went ok
echo '<font color="4C4C4C" size="1" face="Verdana, Arial, Helvetica, sans-serif"><br><br><b>Home Page Content Updated</b><br><br></font>';
} else { // update did not go ok
echo '<p>We are experiencing technical difficulties. Unable to update this record.</p>';
} // end of result check
} // end of save post
} // end of isset id check
break;
} // end switch mode
}
?>
It works fine in terms of editing small amounts of information from the database table. However when i enter alot of information eg. a couple of paragraphs i get the error returned "We are experiencing technical difficulties. Unable to update this record." This means the query isnt working. When i enter small amounts of data into the edit field and update it works fine and its all changed.
The mysql field is set to full text and there is no limit to what can be added to the field. I logged into phpmyadmin and copied the content i was trying to add through the script into the field and it saved it to the database no probem.
Does anyone know what could be causing the script query to fail with large amounts of information been entered into it?
Thanks alot
Jim