{"id":197,"date":"2016-05-07T15:04:10","date_gmt":"2016-05-07T15:04:10","guid":{"rendered":"http:\/\/punjabirevolution.com\/?page_id=197"},"modified":"2016-08-26T13:45:22","modified_gmt":"2016-08-26T13:45:22","slug":"punjabi-revolution-tutorials-php-mysql-connection-part-4-delete","status":"publish","type":"page","link":"http:\/\/punjabirevolution.com\/index.php\/punjabi-revolution-tutorials-php-mysql-connection-part-4-delete\/","title":{"rendered":"Punjabi revolution tutorials PHP MySQL Connection Part 4 delete"},"content":{"rendered":"<p><iframe loading=\"lazy\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/YhPOBopo07Q?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<h2>PHP MySQL &ndash; Deleting table records using Delete query<\/h2>\n<p>it is same as insertion. To delete, we need a the value of the id against which we would execute the delete query.&nbsp; Below is a sample code alongwith explanation.<\/p>\n<pre class=\"lang:php decode:true \">&lt;?php\r\n\r\n$con = new mysqli(\"localhost\",\"root\",\"\",\"wad\");\r\n$q = \"delete from mytable where id = \" . $_GET[\"id\"];\r\nif( $con-&gt;query($q) == TRUE){\r\n\t$con-&gt;close();\r\n\theader(\"location:display.php\");\r\n\t}\r\nelse{\r\n\techo $con-&gt;error;\t\r\n\t$con-&gt;close();\r\n\t}\r\n?&gt;<\/pre>\n<p>Line 4: the string of delete query, whereas the $_GET is used to get the variable passed using get method or query string. This variable can be viewed in URL as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP MySQL \u2013 Deleting table records using Delete query it is same as insertion. To delete, we need a the value of the id against which we would execute the delete query.\u00a0 Below is a sample code alongwith explanation. &lt;?php $con = new mysqli(&#8220;localhost&#8221;,&#8221;root&#8221;,&#8221;&#8221;,&#8221;wad&#8221;); $q = &#8220;delete from mytable where id = &#8221; . $_GET[&#8220;id&#8221;]; &hellip; <a href=\"http:\/\/punjabirevolution.com\/index.php\/punjabi-revolution-tutorials-php-mysql-connection-part-4-delete\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Punjabi revolution tutorials PHP MySQL Connection Part 4 delete&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/197"}],"collection":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":5,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/197\/revisions"}],"predecessor-version":[{"id":751,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/197\/revisions\/751"}],"wp:attachment":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/media?parent=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}