{"id":436,"date":"2012-07-17T16:51:15","date_gmt":"2012-07-17T16:51:15","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=436"},"modified":"2022-02-17T07:14:04","modified_gmt":"2022-02-17T07:14:04","slug":"delete","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/mysql\/queries\/delete-queries\/delete","title":{"rendered":".DELETE General"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Object Oriented Style<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  $stmt = $maindb->prepare(\"DELETE FROM some_table WHERE email_address = ? \");\n  $stmt->bind_param(\"s\", $MyColumn1 );\n  $MyColumn1 = \"abc\";\n  $stmt->execute();\n  $stmt->close();<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Procedural&nbsp;Style<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  mysqli_query($dblink, \"DELETE FROM some_table WHERE email_address = '$email'\");<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Delete old records by date <\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>  mysqli_query($dblink, \"DELETE FROM messages_sent WHERE created_date &lt; DATE_SUB(NOW(), INTERVAL 30 DAY)\");\n\n  \/\/Also:\n  \/\/INTERVAL 1 MONTH\n  \/\/INTERVAL 1 HOUR\n  \/\/etc<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Delete table<\/h5>\n\n\n\n<p>Truncate is the fastest method to delete all data in a table as the table is dropped and re-creaed. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  mysqli_query($dblink, \"TRUNCATE TABLE all_songs\");<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Object Oriented Style Procedural&nbsp;Style Delete old records by date Delete table Truncate is the fastest method to delete all data in a table as the table is dropped and re-creaed.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[263],"tags":[],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-delete-queries"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=436"}],"version-history":[{"count":13,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"predecessor-version":[{"id":3123,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/436\/revisions\/3123"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}