{"id":407,"date":"2021-11-29T13:47:03","date_gmt":"2021-11-29T13:47:03","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=407"},"modified":"2021-12-02T11:08:14","modified_gmt":"2021-12-02T11:08:14","slug":"inserting-data-in-and-deleting-it","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/29\/inserting-data-in-and-deleting-it\/","title":{"rendered":"inserting data in and deleting it"},"content":{"rendered":"\n<p>It\u2019s time to write our first example of inserting data in and deleting it from a MySQL table using PHP.<br>Save file it to your web development directory using the filename <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/data\/insert_delete.txt\">sqltest.php<\/a><\/p>\n\n\n\n<p>It first checks for any inputs that may have been made and then either inserts new data into the table classics of the publications database or deletes a row from it, according to the input supplied. Regardless of whether there was input, the program then outputs all rows in the table to the browser. So, let\u2019s see how it works. The first section of new code starts by using the isset function to check whether values for all the fields have been posted to the program. Upon confirmation, each line within the if statement calls the function get_post, which appears at the end of the program. This function has one small but critical job: fetching input from the browser.<\/p>\n\n\n\n<p>For reasons of clarity and brevity, and to explain things as simply as<br>possible, many of the following examples omit certain very sensible<br>security precautions that would have made them longer and possibly detract from explaining their function in the clearest manner.<br>Therefore, it is important that you don\u2019t skip past the section later<br>in this chapter on preventing your database from being hacked , in which you will learn about additional actions you can take with your code to secure it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s time to write our first example of inserting data in and deleting it from a MySQL table using PHP.Save file it to your web development directory using the filename sqltest.php It first checks for any inputs that may have been made and then either inserts new data into the table classics of the publications &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/29\/inserting-data-in-and-deleting-it\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">inserting data in and deleting it<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/407"}],"collection":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":5,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":454,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions\/454"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}