Updating mysql database with php
string is the My SQL command that we’re going to enter: you’ll notice that it looks similar in syntax to the My SQL commands we entered before.In this case, we’re inserting the values we got from the form into the table “tut_users” that we created earlier on in the tutorial.We use that query, which only deletes records where the USERNAME column matches the username of the radio button.It’s extremely important to note at this juncture that My SQL transactions are permanent!The moment that query runs, there’s no way to get back whatever row it was that you deleted.
Save the file as in your web directory, and go ahead and run it.In general, it’s always a very good idea to keep incremental backups and total backups of My SQL databases, just in case something unforeseen happens- there are few safety nets in My SQL, and there’s not a single DBA or programmer out there who hasn’t accidentally hosed a database with a typo. We could, of course, delete his record and have him create a new account with a new password, but that’s time-consuming and ridiculous. command, you need to be absolutely sure that your script is doing what you need it to do!Nobody wants a typo to turn their “Change Password” page into “Change everybody’s username to Johnson’s password” page.To delete users, however, we need to first know how many there are and what their usernames are.For that, we’re going to use a clause as well: this allows you to create customized My SQL queries to only select certain records from the database (for example, if you only wanted to show users that begin with A or who have a specific name).