Problems Posting Content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
indyboy
Forum Newbie
Posts: 6
Joined: Mon May 10, 2010 4:36 am

Problems Posting Content

Post 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
Kurby
Forum Commoner
Posts: 63
Joined: Tue Feb 23, 2010 10:51 am

Re: Problems Posting Content

Post by Kurby »

Any errors? Code example?

Are you escaping your string before you post them? Is the field size i your database too small?
indyboy
Forum Newbie
Posts: 6
Joined: Mon May 10, 2010 4:36 am

Re: Problems Posting Content

Post 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
Kurby
Forum Commoner
Posts: 63
Joined: Tue Feb 23, 2010 10:51 am

Re: Problems Posting Content

Post by Kurby »

You should check for query errors using mysql_error()
indyboy
Forum Newbie
Posts: 6
Joined: Mon May 10, 2010 4:36 am

Re: Problems Posting Content

Post 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!
Post Reply