Nothadoth Posted July 8, 2007 Share Posted July 8, 2007 Hey. Im creating a CMS for a website and I have made the textbox to allow the admin to edit the content. The content is submitted through the form and into the var $RTE. This is the code I am using: pageedit = $_GET['edit']; $sql = "UPDATE content SET cont = '$RTE' WHERE shortname = $pageedit"; $result = mysql_query($sql); It isn't editting the field. Can someone help? Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted July 8, 2007 Share Posted July 8, 2007 Do you get any errors? Try this: pageedit = $_GET['edit']; $sql = "UPDATE content SET cont = '$RTE' WHERE shortname = $pageedit"; $result = mysql_query($sql) or die(mysql_error()); It will give you a more detailed error from MySQL, if there is any error ofc Quote Link to comment Share on other sites More sharing options...
sinisake Posted July 8, 2007 Share Posted July 8, 2007 Hm... try this: $pageedit = $_GET['edit']; $sql = "UPDATE content SET cont = '$RTE' WHERE shortname = '$pageedit'"; $result = mysql_query($sql); Also, you said that $RTE comes from form, i guess method is 'post'? $RTE=$_POST[RTE]... Quote Link to comment Share on other sites More sharing options...
Nothadoth Posted July 8, 2007 Author Share Posted July 8, 2007 the error is: Unknown column 'rules' in 'where clause' But............ there is a row which has shortname = rules have i done it wrong Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 8, 2007 Share Posted July 8, 2007 Hmm.. Are you sure there's a rules in your shortname column? The error shown doesn't seem to agree with that. Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 8, 2007 Share Posted July 8, 2007 the error is: Unknown column 'rules' in 'where clause' But............ there is a row which has shortname = rules have i done it wrong Your query construct made SQL think you were referring to a COLUMN named rules (that's what the error message said), not that you didn't have a VALUE of rules in the column named shortname. The best way of resolving these types of issue is to have sensible error trapping. Use a syntax similar to the below and tell us exactly what the full error and query are: $sql = " .... whatever your query is ..."; $result = mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql); // helpful message Quote Link to comment Share on other sites More sharing options...
Nothadoth Posted July 9, 2007 Author Share Posted July 9, 2007 thanks, i just changed it to the id field as opose to shortname. works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.