[CS-FSLUG] another sql qustions

David McGlone d.mcglone at att.net
Fri Dec 26 15:29:49 CST 2008

I can't seem to figure out how to write an UPDATE query for this form. I've 
tried several different ways but nothing gets updated in the db. Here is the 
code I have

$query = "SELECT * FROM subheaderText WHERE subheaderTextID=1";
$result = @mysql_query($query);

echo "<form name='subheader' action='$_SERVER[PHP_SELF]' method='POST'>";

while ($row = mysql_fetch_assoc($result)){
echo "<OPTION VALUE='subheaderText'>$row[subheaderText]<br>";
echo "<input type=text name='subheaderText' size='30' 
echo "<input type=text name='pageID' size='10' value='$row[pageID]'>";
echo "<textarea name='headerText' cols='50' rows='15' 
$UpdateQuery = "UPDATE subheaderText SET  'subheaderText=subheaderText', 
'pageID=pageID', 'headerText]=headerText'";

$result2= mysql_query($updateQuery);

echo '<input type="submit" name="submit" value="Update" /><br>';
echo '</form><br>';

What in Tarnation have I done wrong?
I'm slowly learning mySQL, but it sure is mentally tiring!
David M.

More information about the Christiansource mailing list