Updating database using php

In our previous code Igniter tutorials, we explained you, how to perform insertion and deletion operation on database using Code Igniter.

updating database using php-86

Here's an example of the data from a sample form: To prevent possible SQL injection vulnerabilities to your database, we'll need to run PHP's addslash() function for every post variable.

And since the $_POST data is an array, let's make a function that will loop on every variable: To check if an insert or an update should be done, a search should be initialized if the submission ID exists and then set a condition that if the submission ID exists, an update should be initialized using that submission ID.

See also My SQL: choosing an API guide and related FAQ for more information.

Alternatives to this function include: Returns the number of affected rows on success, and -1 if the last query failed.

The data being posted by Jot Form is actually an array so to find out the array keys and values, you will have to try to insert this in your script: Do an actual submission to test your form and get the result.

Last modified 18-May-2019 00:57