Jump to content

Unable to update data for a column in MySQL table


DMB
Go to solution Solved by DMB,

Recommended Posts

  • Solution

The list of person info is showing HTML tabular format, for which the code have attached (file name is admin.php line number 338-377). For this script output is displaying properly.

But the functionality is whenever we will click the tick mark (which is in line number 370-372), at that moment it should update the table, for which the script appr.php is attached.

But it's not updating the table.

Could you please help me to update the data in table.

admin.txt appr.txt

Link to comment
Share on other sites

14 minutes ago, DMB said:

click the tick mark

does the browser goto appr.php with a valid id=xxx on the end of the url?

btw - you should be using a post method form when performing an action on the server.

also, when learning, developing, and debugging code/query(ies), you should display all php errors. error_reporting should always be set to E_ALL and display_errors should be set to ON, preferably in the php.ini on your system. by setting error_reporting to zero in your code, php won't help you find problems that it detects.

you should always have error handling for statements that can fail. for database statement that can fail - connection, query, prepare, and execute, the simplest way of adding error handling, without adding code at each statement, is to use exceptions for errors and in most cases let php catch the exception, where php will use its error related settings (see the above paragraph) to control what happens with the actual error information (database statement errors will 'automatically' get displayed/logged the same as php errors.) to enable exceptions for errors for the mysqli extension, add the following line of code before the point where you make the database connection -

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

next, you should always trim, then validate inputs before using them. if a required input doesn't exist, that's an error and you should setup a message for the user and not attempt to run any code that must have the input.

you should not put external, unknown, dynamic values directly into an sql query statement. use a prepared query instead. you would also want to switch to the much simpler PDO database extension.

ids in the html document must be unique. if you are not using any particular id at all, simply leave it out of the markup. you should validate your html markup at validator.w3.org

  • Like 1
Link to comment
Share on other sites

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.