using fck editor to update mysql tables
Posted: Sat Oct 20, 2007 12:50 pm
Everah | Please use I then call the original post through by using this:
And then my fckeditor is set up as follows:
Thanks in advance...
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
i downloaded and installed fckeditor into my website yesterday and i am using it to post blogs on to my website. I can successfully create new posts and they display correctly..
I also want to use it to edit existing posts in my database.
I can get fck editor to display my posts that i want to edit but i cannot get it to update my database, it appears to work but when i look at the posts i have edited, it hasn't updated at all.
If anyone has any ideas, i would be very, VERY pleased to hear them!
I am using PHP and i'm using a Mysql database..
my current code looks something like this.Code: Select all
<?php
include("fckeditor.php");
session_start();
//insert my db connection details
include ("vars.inc");
if(isset($_POST['theComment'])){
$query = "UPDATE article SET name='".$_SESSION[logname]."',title='".$_POST['title']."',comments='".$_POST[comment]."'
where artid ='".$_GET['aid']."'";
if(!mysqli_query($cxn,$query)){
echo mysqli_error($cxn);
}else{
header("location:main.php");
exit;
}
}
?>Code: Select all
<?php
$query1 = "select * from article where artid ='".$_GET['aid']."'";
$edit_blog = mysqli_query($cxn, $query1) or die (mysqli_error($cxn));
$blog_result = mysqli_fetch_assoc($edit_blog);
?>Code: Select all
<?php
$content = $blog_result['comments'];
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor('comment') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Width = '100%' ;
$oFCKeditor->Height = '300' ;
$oFCKeditor->Value = $content;
$oFCKeditor->Create() ;
?>Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]