- 'id' (int(11))
- 'name' (varchar(30)
- 'title' (varchar(30)
- 'content' (varchar(65466)
edit_pagename.php
<?php
include_once("fckeditor/fckeditor.php") ;
?>
<html>
<head>
<title>Edit Page: Pagename</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<center><b>Edit Page: Pagename</b></center>
<a href='javascript:history.back(-1)'><img src="back.gif" alt="Go Back" border="0" /></a> <a href="logout.php"><img src='logout.gif' onmouseover="this.src='logoutover.gif'" onmouseout="this.src='logout.gif'" alt="Logout" border='0' /></a>
<hr>
<form action="pages_edit_about_update.php" method="post">
Header: <input type="text" name="title" id="title" value="
<?php
mysql_connect("localhost", "database_username", "password") or die(mysql_error());
mysql_select_db("some_database") or die(mysql_error());
$result = mysql_query("SELECT * FROM pages WHERE name='pagename'") or die(mysql_error());
$row = mysql_fetch_array( $result );
echo $row['title'];
?>
" />
//^^ this sets the value property of an <input> tag to a specific 'title' value.
//see above where i define the fields of my mySQL table
<br>
<?php
mysql_connect("localhost", "database_username", "password") or die(mysql_error());
mysql_select_db("some_database") or die(mysql_error());
$result = mysql_query("SELECT * FROM pages WHERE name='about'") or die(mysql_error());
$row = mysql_fetch_array( $result );
$gotdata = stripslashes($row['content']) ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = 'fckeditor/' ;
$oFCKeditor->Value = $gotdata ;
$oFCKeditor->Create() ;
?>
<br>
<input type="submit" value="Submit">
</form>
<br>
<a href="techsupport.php">Technical Support</a>
</body>
</html>
edit_pagename_update.php
<?php
$mytitle = $_POST['title'];
$content = $_POST['FCKeditor1'];
$myid = 3;
$con = mysql_connect("localhost","database_username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("some_database", $con);
mysql_query("UPDATE pages SET content = $content WHERE id = $myid") or die(mysql_error());
mysql_close($con);
?>
'<p>About site can go here!</p>'
<p>About site can go here! testingtesting123!</p>
edit_pagename_update.phpedit_pagename.php
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 ' About site can go here! testingtesting123! WHERE id = 3' at line 1

Re: PHP/mySQL update help
mysql_query("UPDATE pages SET content = '$content' WHERE id = '$myid'") or die(mysql_error());
Additionally, make sure you using addslashes to $content as a safeguard and to make sure quotes and such are escaped properly.
Re: PHP/mySQL update help
I am getting data for the $updaterunid, $updaterun, $updatecontent it shows it on the screen but it won't update the mysql database. Please look at code below to perform update.
Can you help me?
<?php include "connect.php"; $updaterunid = $_POST['myrunid']; $updaterun = $_POST['myrun']; $updatecontent = mysql_real_escape_string(trim($_POST['FCKeditor1'])); print $_POST['myrunid']; print $_POST['myrun']; mysql_query("UPDATE schedule SET RUNID = '$updaterunid', RUN = '$updaterun' , CONTENT = '$updatecontent' WHERE RUNID = '$updaterunid' ") or die(mysql_error()); include "adminshowschedule.php"; include "closeconnect.php"; ?>