Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/303035-live-table-edit-not-updating/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.