MsKazza Posted January 26, 2017 Share Posted January 26, 2017 Hi there, I was trying to do a live table edit for our site. Everything seemed to be going ok, till i realised that its not actually updating the database, there are no error messages, you have to refresh the page to see it hasn't worked. I'm at a loss as to why was hoping someone might be able to point me in the right direction. thanks, MsKazza tableedit.php table_edit_ajax.php Quote Link to comment https://forums.phpfreaks.com/topic/303035-live-table-edit-not-updating/ Share on other sites More sharing options...
mac_gyver Posted January 27, 2017 Share Posted January 27, 2017 your table_edit_ajax.php code isn't outputting anything back in response to the ajax request, nor does it have any query error checking logic in it, nor does your ajax code do anything with any returned data from the .php code. you MUST have error checking/handling logic in your code, so that your code does something expected when there is an error. your ajax code has a success handler, but it doesn't have an error handler. if the server doesn't respond, shouldn't your ajax code do something? next, all your ajax success handler does is put the two existing values back into the <span></span> elements. shouldn't your php code return a value to the ajax code and your ajax code use that value to tell the user if the operation was successful or not? lastly, the php mysql_ extension is obsolete and has been removed from the latest php version for more than a year. you need to switch your code to use the php PDO extension instead and use prepared queries to supply data values to the sql query statement. this will actually simplify your code since you will no longer need to call the ...escape_string() functions for every pieced of data. Quote Link to comment https://forums.phpfreaks.com/topic/303035-live-table-edit-not-updating/#findComment-1542040 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.