Edit Page PHP (UPDATE RECORDS)
<?
/* Include Configuration Files */
include_once "../config/config.php";
//Edit Page
$edit = $_GET["edit"];
if("yes" == $edit) {
/* Update Page within database. */
$year = date('Y');
$month = date('m');
$day = date('d');
$con = mysql_connect("$server","$dbuser","$dbpass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
$id = $_POST["id"];
$title1 = $_POST["title"];
$content1 = $_POST["website_content"];
$visible = $_POST["visible"];
mysql_query("UPDATE ap_pages SET title = '$title1' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET content = '$content1' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET dateedit = '$year-$month-$day' WHERE id LIKE '$id'");
mysql_query("UPDATE ap_pages SET visible = '$visible' WHERE id LIKE '$id'");
mysql_close($con);
echo '<div class="alertsuccess_info">
<strong>Page Modified Successfully</strong> - Your changes have taken effect immeadiately. </div>';
echo "<meta http-equiv='refresh' content='3;url=index.php?ToDo=WebsiteContent/ViewPages' />";
}
if("yes" != $edit) {
$con = mysql_connect("$server","$dbuser","$dbpass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
$pageid = $_GET["id"];
$result = mysql_query("SELECT * FROM ap_pages WHERE id = '$pageid'");
while($row = mysql_fetch_array($result))
{
$id = $row['id'];
$title1 = $row['title'];
$content = $row['content'];
$date = $row['date'];
$date1 = $row['dateedit'];
$visible = $row['visible'];
}
}
?>New Page PHP script
<?
/* Include Configuration Files */
include_once "../config/config.php";
/* Retrieve META Data From Database */
//Add Page
$save = $_GET["save"];
if("yes" == $save) {
/* Update Page Information throughout database. */
$title = $_POST["title"];
$website_content = $_POST["website_content"];
$year = date('Y');
$month = date('m');
$day = date('d');
$date2 = $year-$month-$date;
$visible = $_POST["visible"];
mysql_connect($server, $dbuser, $dbpass)
or die ("Could not connect to mysql because ".mysql_error());
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
$query = mysql_query("SELECT * FROM ap_pages WHERE title LIKE '$title'");
$num_rows = mysql_num_rows($query);
if(empty($title) || empty($content) || empty($visible)) {
echo "<div class='alerterror_info'>
<strong>Please Complete All Fields</strong> - $fname, Please complete all of the fields inorder to add this page successfully. </div>";
$title1 = $_POST["title"];
$website_content_one = $_POST["website_content"];
}
elseif('0' == $num_rows) {
mysql_query("INSERT INTO ap_pages (title, content, date, dateedit, visible)
VALUES ('$title', '$website_content', '$year-$month-$day', '$year-$month-$day', '$visible')");
echo "<div class='alertsuccess_info'><strong>Page Added Successfully</strong> - This page has been added successfully. You selected $visible for visibility. Forwarding to page listings in 3 seconds.</div>";
echo '<meta http-equiv="refresh" content="3;url=index.php?ToDo=WebsiteContent/ViewPages" />';
}
else {
echo '<meta http-equiv="refresh" content="0;url=index.php?ToDo=WebsiteContent/ViewPages&error=yes1" />';
}
}
?>Many Thanks In Advance!!!!

Re: I really need your help!!! :( - MY FCKeditor wont work
Re: I really need your help!!! :( - MY FCKeditor wont work
Can you explain this a bit more clearly? When does it fail - on editor page load, during editing, on submit? What is the nature of the failure? Do you get error codes?
I have a small CMS that I've just updated to use FCK and it was generally a breeze. my first reaction to what you've described is to note that FCK is only going to effect what is going on on the client (browser) end of things. Once the user submits the form, PHP deals with the output in the same way that it does the output of a textfield. If your code works with a textfield, it should work just the same with the output of an editor.
Here are a couple of things that you need to pay attention to:
1) does your code work WITHOUT fck?
2) how are you handling the data on the server side? (encoding, etc.)
Read the docs! it helps ... I've learned that the hard way!