View Full Version : Update query does not work. Why

03-27-2006, 08:31 PM

I use HTMLAREA to view and update webpage content but the update part is not working. Does anyone know why?
Link to sample ( see what I mean ) :
Sample (http://www.stmartinsgaa.nl/htmlarea/Update_club.php)
Thanks in advance.

<form name="St Martins GAA" method="post" action="">
<table width="513" border="1" cellpadding="2" cellspacing="0" bordercolor="#5493B4">
<td bgcolor="#5493B4" width="875">
<table width="696" cellpadding="2" cellspacing="0">
<td bgcolor="#5493B4" width="692"> <table width="500" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="ACA899">
<input name="onderwerp" type="text" id="onderwerp" value="Our Club" size="20">
<div align="left"></div>
<div align="left">
<span style="background-color: #5493B4">
<textarea name="Club" style="width:100%; height:500" rows="1" cols="20">
//alle aanwezige info in de SQL db wordt hieronder weergegeven;
//in elke rij is een veld edit beschikbaar. Dit is een link naar edit.php met GET variabelen;
$db = @mysql_pconnect("localhost", "stmartins", "paddy")
or die ("De verbinding met de SQL server is mislukt");
@mysql_select_db("gaa", $db)
or die ("verbinding db mislukt");
$query = "SELECT * FROM content WHERE Id = '1'"; //Page number;
$result = mysql_query($query, $db);
if($result) {
while ($id_row = mysql_fetch_array($result)) {

echo "<tr>
<td bgcolor='FFFFFF'><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><div align='center'>", $id_row['Content'],"</div></font></td></tr>";
else {
echo "Data not found";
<input type="submit" name="Submit" value="Update">
<script language="javascript1.2">
var config = new Object(); // create new config object

config.width = "90%";
config.height = "200px";
config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
config.debug = 0;

// NOTE: You can remove any of these blocks and use the default config!

config.toolbar = [
// ['strikethrough','subscript','superscript','separator'],

config.fontnames = {
"Arial": "arial, helvetica, sans-serif",
"Courier New": "courier new, courier, mono",
"Georgia": "Georgia, Times New Roman, Times, Serif",
"Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
"Times New Roman": "times new roman, times, serif",
"Verdana": "Verdana, Arial, Helvetica, sans-serif",
"impact": "impact",
"WingDings": "WingDings"
config.fontsizes = {
"1 (8 pt)": "1",
"2 (10 pt)": "2",
"3 (12 pt)": "3",
"4 (14 pt)": "4",
"5 (18 pt)": "5",
"6 (24 pt)": "6",
"7 (36 pt)": "7"

//config.stylesheet = "http://www.domain.com/sample.css";

config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
{ name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
{ name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
{ name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }

// leave classStyle blank if it's defined in config.stylesheet (above), like this:
// { name: "verdana blue", className: "headline4", classStyle: "" }

</div> </td>

\\ Update Section

If ($Submit) {
// invoervelden uit cms_edit.php ophalen;
$id_row = $_POST['Club'];

// verbinding maken met de db;
$db = @mysql_pconnect("localhost", "stmartins", "paddy")
or die ("De verbinding met de SQL server is mislukt");
@mysql_select_db("gaa", $db)
or die ("verbinding db mislukt");

// nu de invoervelden in de SQL DB updaten;
$query = "UPDATE content SET Content = '$id_row'";
mysql_query($query) or die ("query mislukt");
echo "<script language = 'javascript'>alert('The update is complete');</script>";
echo "<script language = 'javascript'>window.location='index.php';</script>";