Page 1 of 1

Problems Posting Content

Posted: Thu Jun 17, 2010 2:11 pm
by indyboy
Hey everyone,

Im trying to use tinymce in a cms (homemade- php) to edit a pages content, However i can only seem to post 2 or 3 lines of content to the database, if i try and post anymore than this then it just doesnt update at all.

I know this isnt the best way to make a cms but its my first attempt

Anybody got any ideas

Cheers

Re: Problems Posting Content

Posted: Thu Jun 17, 2010 2:24 pm
by Kurby
Any errors? Code example?

Are you escaping your string before you post them? Is the field size i your database too small?

Re: Problems Posting Content

Posted: Thu Jun 17, 2010 2:41 pm
by indyboy
hey no errors, goes to success message.

the database is set to a longtext, tried multiple settings set with the limitcharacters

Form Code

Code: Select all

		<?php
//import the database connection file
include("connect.php");
// Send the preloaded content to the function.
$request ='faqs';
$query = mysql_query( "SELECT * FROM contents WHERE page = '".$request."'");
//fetch the results of the $query and store them in $row
$row = mysql_fetch_array($query);

?>
<form name="update" action="updatefaq.php" method="post">
  <p>&nbsp;    </p>
 
    <textarea name="elm1"><?php echo $row['content'];?></textarea>

  </script>
    <input name="submit" type="submit" value="Submit" />

</form>
Process Code

Code: Select all

<?php

//import the database connection file
include("connect.php");
//The UPDATE query used ... this is used to CHANGE an existing record to the users table
$request ='faqs';


mysql_query("UPDATE contents SET content = '".$_POST['elm1']."' WHERE page =
'$request'"); 

echo "Thank you! Information updated.";
mysql_close($dbconnection);
?>
Above is the code minus tinymce - as it isnt working without it either

Re: Problems Posting Content

Posted: Thu Jun 17, 2010 2:53 pm
by Kurby
You should check for query errors using mysql_error()

Re: Problems Posting Content

Posted: Thu Jun 17, 2010 3:06 pm
by indyboy
im not sure i put the error function in right but i put

Code: Select all

<?php

//import the database connection file
include("connect.php");

//The UPDATE query used ... this is used to CHANGE an existing record to the users table
$request ='faqs';

$sql= mysql_query("UPDATE contents SET content = '".$_POST['elm1']."' WHERE page =
'$request'"); 
if (!$sql)
  {
  die(mysql_error());
  }

echo "Thank you! Information updated.";
mysql_close($dbconnection);
?>
and it came up with

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonexistentdb' 1146: Table 'kossu.nonexistenttable' doesn't exist Se' at line 1

Which really doesnt mean much to me!