{"id":314,"date":"2013-07-27T20:33:58","date_gmt":"2013-07-27T12:33:58","guid":{"rendered":"http:\/\/140.112.31.82\/wordpress\/?p=314"},"modified":"2013-07-27T20:33:58","modified_gmt":"2013-07-27T12:33:58","slug":"update-php","status":"publish","type":"post","link":"https:\/\/cflin.com\/wordpress\/314\/update-php","title":{"rendered":"update.php"},"content":{"rendered":"<pre class=\"lang:default decode:true \" >&lt;form action=\"\" method=\"post\" name=\"form1\"&gt;&lt;br&gt;\nInput address book data:&lt;br&gt;\n&lt;input name=\"name\" type=\"text\" value=\"\n&lt;?php\n    if($_POST['submit']=='Update') {\n\t\techo $_POST['name'];\n\t}\n\telse {\n\t\techo $_GET['name'];\n\t}\n?&gt;\n\"&gt;&lt;br&gt;\n&lt;input name=\"phone\" type=\"text\" value=\"\n&lt;?php\n    if($_POST['submit']=='Update') {\n\t\techo $_POST['phone'];\n\t}\n\telse {\n\t\techo $_GET['phone'];\n\t}\n?&gt;\n\"&gt;&lt;br&gt;\n&lt;input name=\"address\" type=\"text\" value=\"\n&lt;?php\n    if($_POST['submit']=='Update') {\n\t\techo $_POST['address'];\n\t}\n\telse {\n\t\techo $_GET['address'];\n\t}\n?&gt;\n\"&gt;&lt;br&gt;\n&lt;input name=\"submit\" type=\"submit\" value=\"Update\"&gt;&lt;br&gt;\n&lt;\/form&gt;\n&lt;?php\n\n\/\/\u5efa\u7acb\u8cc7\u6599\u9023\u7dda\u7269\u4ef6\n$pdo = new PDO(\"sqlite:mydb.sqlite\");\n\n$pdo-&gt;exec(\"CREATE TABLE address_book (\nsid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,\nname VARCHAR,\nphone VARCHAR,\naddress VARCHAR,\ncreation_date DATETIME DEFAULT CURRENT_TIMESTAMP)\");\n\nif( isset($_POST['submit']) &amp;&amp; $_POST['submit']=='Update' ) {\n    \/\/ \u6e96\u5099\u65b0\u589e\u8cc7\u6599\u7684\u8a9e\u6cd5\n    $name = $_POST[\"name\"];\n    $phone = $_POST[\"phone\"];\n    $address = $_POST[\"address\"];\n\t$pdo-&gt;exec(\"UPDATE 'address_book' SET name='$name', phone='$phone', address='$address' where sid=$_GET[sid]\");\n}\n\nif( $_GET['op']=='del' ) {\n\/\/ \u6e96\u5099\u522a\u9664\u8cc7\u6599\u7684\u8a9e\u6cd5\n$pdo-&gt;exec(\"DELETE FROM 'address_book' WHERE\nSID=$_GET[sid]\");\n}\n\n\n$pdoStatement = $pdo-&gt;query(\"SELECT * FROM address_book\");\n\n\/*\nwhile($row = $pdoStatement-&gt;fetch() ) {\n    print_r( $row );\n}\n*\/\nmakeTable($pdoStatement);\n\nfunction makeTable($pdoStatement)\n{\n\techo $_POST[\"sql\"].\"&lt;br&gt;\";\n\techo \"&lt;table border='1'&gt;\";\n\t\/\/\u8a2d\u5b9aTitle\n\techo \"&lt;tr&gt;&lt;td&gt;sid&lt;\/td&gt;\";\n\techo \"&lt;td&gt;name&lt;\/td&gt;\";\n\techo \"&lt;td&gt;phone&lt;\/td&gt;\";\n\techo \"&lt;td&gt;address&lt;\/td&gt;\";\n\techo \"&lt;td&gt;&lt;\/td&gt;&lt;\/tr&gt;\";\n\t\/\/\u8b80\u53d6\u5167\u5bb9\n\twhile($row = $pdoStatement-&gt;fetch(PDO::FETCH_ASSOC) ) {\n\techo \"&lt;tr&gt;&lt;td&gt;$row[sid]&lt;\/td&gt;\";\n\techo \"&lt;td&gt;$row[name]&lt;\/td&gt;\";\n\techo \"&lt;td&gt;$row[phone]&lt;\/td&gt;\";\n\techo \"&lt;td&gt;$row[address]&lt;\/td&gt;\";\n\techo \"&lt;td&gt;&lt;a href=add.php?op=del&amp;sid=$row[sid]&gt;del&lt;\/a&gt;&lt;\/td&gt;&lt;\/tr&gt;\";\n\t}\n\techo \"&lt;\/table&gt;\";\n}\n\n\n\n\n\n?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;form action=\"\" method=\"post\" name=\"form1&#8243;&gt;&lt;br&gt; Input address book data:&lt;br&gt; &lt;input name=\"name\" type=\"text\" value=\" &lt;?php if($_POST[&#8216;submit&#8217;]==&#8217;Update&#8217;) { echo $_POST[&#8216;name&#8217;]; } else { echo $_GET[&#8216;name&#8217;]; } ?&gt; &#8220;&gt;&lt;br&gt; &lt;input name=\"phone\" type=\"text\" value=\" &lt;?php if($_POST[&#8216;submit&#8217;]==&#8217;Update&#8217;) { echo $_POST[&#8216;phone&#8217;]; } else { echo $_GET[&#8216;phone&#8217;]; } ?&gt; &#8220;&gt;&lt;br&gt; &lt;input name=\"address\" type=\"text\" value=\" &lt;?php if($_POST[&#8216;submit&#8217;]==&#8217;Update&#8217;) { echo $_POST[&#8216;address&#8217;]; } else { echo &hellip; <a href=\"https:\/\/cflin.com\/wordpress\/314\/update-php\" class=\"more-link\">\u95b1\u8b80\u5168\u6587 <span class=\"screen-reader-text\">update.php<\/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":{"_mi_skip_tracking":false},"categories":[4],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cflin.com\/wordpress\/314\/update-php\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)\" \/>\n<meta property=\"og:description\" content=\"&lt;form action=&quot;&quot; method=&quot;post&quot; name=&quot;form1&quot;&gt;&lt;br&gt; Input address book data:&lt;br&gt; &lt;input name=&quot;name&quot; type=&quot;text&quot; value=&quot; &lt;?php if($_POST[&#039;submit&#039;]==&#039;Update&#039;) { echo $_POST[&#039;name&#039;]; } else { echo $_GET[&#039;name&#039;]; } ?&gt; &quot;&gt;&lt;br&gt; &lt;input name=&quot;phone&quot; type=&quot;text&quot; value=&quot; &lt;?php if($_POST[&#039;submit&#039;]==&#039;Update&#039;) { echo $_POST[&#039;phone&#039;]; } else { echo $_GET[&#039;phone&#039;]; } ?&gt; &quot;&gt;&lt;br&gt; &lt;input name=&quot;address&quot; type=&quot;text&quot; value=&quot; &lt;?php if($_POST[&#039;submit&#039;]==&#039;Update&#039;) { echo $_POST[&#039;address&#039;]; } else { echo &hellip; \u95b1\u8b80\u5168\u6587 update.php &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cflin.com\/wordpress\/314\/update-php\" \/>\n<meta property=\"og:site_name\" content=\"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)\" \/>\n<meta property=\"article:published_time\" content=\"2013-07-27T12:33:58+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chifu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cflin.com\/wordpress\/#website\",\"url\":\"https:\/\/cflin.com\/wordpress\/\",\"name\":\"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)\",\"description\":\"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed python \u8ab2\u7a0b\u76f8\u95dc\u8cc7\u6599\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cflin.com\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cflin.com\/wordpress\/314\/update-php#webpage\",\"url\":\"https:\/\/cflin.com\/wordpress\/314\/update-php\",\"name\":\"update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)\",\"isPartOf\":{\"@id\":\"https:\/\/cflin.com\/wordpress\/#website\"},\"datePublished\":\"2013-07-27T12:33:58+00:00\",\"dateModified\":\"2013-07-27T12:33:58+00:00\",\"author\":{\"@id\":\"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/fcc9937e50465bfaa039229ad12d89aa\"},\"breadcrumb\":{\"@id\":\"https:\/\/cflin.com\/wordpress\/314\/update-php#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cflin.com\/wordpress\/314\/update-php\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cflin.com\/wordpress\/314\/update-php#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\/\/cflin.com\/wordpress\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"update.php\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/fcc9937e50465bfaa039229ad12d89aa\",\"name\":\"Chifu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/83c3d40c89fb05d334f2a3eddcfb4ac7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/83c3d40c89fb05d334f2a3eddcfb4ac7?s=96&d=mm&r=g\",\"caption\":\"Chifu\"},\"sameAs\":[\"http:\/\/cflin.com\"],\"url\":\"https:\/\/cflin.com\/wordpress\/author\/daky\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cflin.com\/wordpress\/314\/update-php","og_locale":"zh_TW","og_type":"article","og_title":"update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)","og_description":"&lt;form action=\"\" method=\"post\" name=\"form1\"&gt;&lt;br&gt; Input address book data:&lt;br&gt; &lt;input name=\"name\" type=\"text\" value=\" &lt;?php if($_POST['submit']=='Update') { echo $_POST['name']; } else { echo $_GET['name']; } ?&gt; \"&gt;&lt;br&gt; &lt;input name=\"phone\" type=\"text\" value=\" &lt;?php if($_POST['submit']=='Update') { echo $_POST['phone']; } else { echo $_GET['phone']; } ?&gt; \"&gt;&lt;br&gt; &lt;input name=\"address\" type=\"text\" value=\" &lt;?php if($_POST['submit']=='Update') { echo $_POST['address']; } else { echo &hellip; \u95b1\u8b80\u5168\u6587 update.php &rarr;","og_url":"https:\/\/cflin.com\/wordpress\/314\/update-php","og_site_name":"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)","article_published_time":"2013-07-27T12:33:58+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Chifu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/cflin.com\/wordpress\/#website","url":"https:\/\/cflin.com\/wordpress\/","name":"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)","description":"\u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed python \u8ab2\u7a0b\u76f8\u95dc\u8cc7\u6599","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cflin.com\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-TW"},{"@type":"WebPage","@id":"https:\/\/cflin.com\/wordpress\/314\/update-php#webpage","url":"https:\/\/cflin.com\/wordpress\/314\/update-php","name":"update.php - \u53f0\u5927\u7cfb\u7d71\u8a13\u7df4\u73ed\u8ab2\u7a0b\u7db2\u9801 (\u6797\u5947\u8ce6)","isPartOf":{"@id":"https:\/\/cflin.com\/wordpress\/#website"},"datePublished":"2013-07-27T12:33:58+00:00","dateModified":"2013-07-27T12:33:58+00:00","author":{"@id":"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/fcc9937e50465bfaa039229ad12d89aa"},"breadcrumb":{"@id":"https:\/\/cflin.com\/wordpress\/314\/update-php#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cflin.com\/wordpress\/314\/update-php"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cflin.com\/wordpress\/314\/update-php#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/cflin.com\/wordpress"},{"@type":"ListItem","position":2,"name":"update.php"}]},{"@type":"Person","@id":"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/fcc9937e50465bfaa039229ad12d89aa","name":"Chifu","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/cflin.com\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/83c3d40c89fb05d334f2a3eddcfb4ac7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/83c3d40c89fb05d334f2a3eddcfb4ac7?s=96&d=mm&r=g","caption":"Chifu"},"sameAs":["http:\/\/cflin.com"],"url":"https:\/\/cflin.com\/wordpress\/author\/daky"}]}},"_links":{"self":[{"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/posts\/314"}],"collection":[{"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/comments?post=314"}],"version-history":[{"count":0,"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/posts\/314\/revisions"}],"wp:attachment":[{"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/media?parent=314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/categories?post=314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cflin.com\/wordpress\/wp-json\/wp\/v2\/tags?post=314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}