March 30, 200917 yr Hey everyone, On my CMS that I am writing, I am trying to edit a page using PHP and MySQL, however, when I submit the changes, nothing gets updated in the DB. I tried to do a bit of checking and made it print out the SQL statement instead of processing it, this is what I got: UPDATE pages SET page_name = 'testpage 222', page_desc = 'thisistestpage', page_content = ' Test Page 2 This is another test to see that everything is working! ' WHERE page_id = '3' It seems okay to me, this is what is annoying me though, because I have done this so many times, yet this is the first time I have had a problem. If anyone could point me in the right direction that would be really cool Thanks
March 30, 200917 yr Is it not because you are trying to insert the html straight into the DB? You should use mysql_real_escape_string() and maybe htmlencode() to filter what's being put into theDB.
March 30, 200917 yr Author Is it not because you are trying to insert the html straight into the DB? You should use mysql_real_escape_string() and maybe htmlencode() to filter what's being put into theDB. I tried putting them in aswell, but it is still not updating. This is turning into quite the beard scratcher over here BIG BAD EDIT: I turned mysql_error reporting on and this is what I got back: Unknown column 'page_name' in 'field list'
March 30, 200917 yr Can you check your spellings in the database compared to the query? That error sounds like there is a typo somewhere.
March 30, 200917 yr Author Its official, I feel stupid Checked the database again, and instead of page_name it should of been page_title Thanks for the help anyway Jmz
March 30, 200917 yr I think that sort of thing happens to everyone now and again Yeah, I have done it several times.
Create an account or sign in to comment