Hi guys, I'm having a problem with this bit of code that is supposed to update my database with a text field and dropdown selection using ajax. The first part of the code has the Ajax function The second part has the Edit fields that include 1) a text field & an associated dropdown 2) a second text field & it's associated dropdown 3) a save button that calls the ajax function The third part of the code has the Display fields that shows the updated result of the ajax and mysql update. The last part of the code (on a seperate page) has all the database updates that are called when the ajax function is called. The issue is that normally the code works perfectly and the database and the Display field is updated using the ajax just fine, BUT if I enter in the same data in both text fields (screename & screename2), example "a" and "a" which updates the database ok and then remove the data from both text fields which still updates the database ok and then try to RE-ADD the same data again "a" and "a" the database doesn't get updated. It refuses to update UNLESS i use different data for one of the text fields. Then (assuming I use different data) it will update the database, BUT it won't allow me to then delete the data and do an update. I tried a bunch of different options to resolve the problem, but it never seems to go away no matter what I do, can you help? Thanks! Will Code ATTACHED (comments are not in the real code, just added here):
i'd like to help but need to know where exactly it stops functioning, also...you connect to your database 3 times...not needed.
Thanks for your reply It actually functions perfectly as long as you are updating the text fields with totally new (not empty field) information each time, where it stops working is at this instance. (Let me explain in a different way): If I enter in the same data in both text fields (screename & screename2). Example: Using the text "a" and "a" and then try to remove the data (removing the text and fields are blank) from both text fields which still updates THEN try to RE-ADD the same text "a" and "a" again - THEN the database doesn't get updated. It refuses to update UNLESS i use different text for one of the text fields. - THEN (assuming I use different text) it will update the database, BUT it won't allow me to delete that data (removing the text and fields are blank). It feels like whenever I enter in the same data somehow they are being cached by mysql (?) and then when it sees the same data again it ignores my attempt to update it OR maybe when the text fields are blank it is updating the database with something that is being stored in those fields even tho the database table is showing me nothing. I tried 20 different things to flush the bug out, but it keeps persisting.