{"id":67,"date":"2013-12-03T03:01:05","date_gmt":"2013-12-02T19:01:05","guid":{"rendered":"http:\/\/www.yptk.cn\/index.php\/2013\/12\/03\/%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e4%ba%94%e5%a4%a9\/"},"modified":"2013-12-03T03:01:05","modified_gmt":"2013-12-02T19:01:05","slug":"%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e4%ba%94%e5%a4%a9","status":"publish","type":"post","link":"http:\/\/yptk.cn\/index.php\/2013\/12\/03\/%e5%8d%81%e5%a4%a9%e5%ad%a6%e4%bc%9aphp%e4%b9%8b%e7%ac%ac%e4%ba%94%e5%a4%a9\/","title":{"rendered":"\u5341\u5929\u5b66\u4f1aphp\u4e4b\u7b2c\u4e94\u5929"},"content":{"rendered":"<p><span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">\u5b66\u4e60\u76ee\u7684\uff1a\u5b66\u4f1a\u8bfb\u53d6\u6570\u636e<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u5148\u770b\u4e24\u4e2a\u51fd\u6570\uff1a<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; 1\u3001mysql_query&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u9001\u51fa\u4e00\u4e2a query \u5b57\u7b26\u4e32\u3002 \u8bed\u6cd5: int mysql_query(string query, int [link_identifier]); \u8fd4\u56de\u503c: \u6574\u6570<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u672c\u51fd\u6570\u9001\u51fa query \u5b57\u7b26\u4e32\u4f9b MySQL \u505a\u76f8\u5173\u7684\u5904\u7406\u6216\u8005\u6267\u884c\u3002\u82e5\u6ca1\u6709\u6307\u5b9a link_identifier \u53c2\u6570\uff0c\u5219\u7a0b\u5e8f\u4f1a\u81ea\u52a8\u5bfb\u627e\u6700\u8fd1\u6253\u5f00\u7684 ID\u3002\u5f53 query \u67e5\u8be2\u5b57\u7b26\u4e32\u662f UPDATE\u3001INSERT \u53ca DELETE \u65f6\uff0c\u8fd4\u56de\u7684\u53ef\u80fd\u662f true \u6216\u8005 false\uff1b\u67e5\u8be2\u7684\u5b57\u7b26\u4e32\u662f SELECT \u5219\u8fd4\u56de\u65b0\u7684 ID \u503c\uff0c\u5f53\u8fd4\u56de false \u65f6\uff0c\u5e76\u4e0d\u662f\u6267\u884c\u6210\u529f\u4f46\u65e0\u8fd4\u56de\u503c\uff0c\u800c\u662f\u67e5\u8be2\u7684\u5b57\u7b26\u4e32\u6709\u9519\u8bef\u3002&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; 2\u3001mysql_fetch_object \u8fd4\u56de\u7c7b\u8d44\u6599\u3002 \u8bed\u6cd5: object mysql_fetch_object(int result, int [result_typ]); \u8fd4\u56de\u503c: \u7c7b&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u672c\u51fd\u6570\u7528\u6765\u5c06\u67e5\u8be2\u7ed3\u679c result \u62c6\u5230\u7c7b\u53d8\u91cf\u4e2d\u3002\u82e5 result \u6ca1\u6709\u8d44\u6599\uff0c\u5219\u8fd4\u56de false \u503c\u3002<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u770b\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; $exec=&#8221;select * from user&#8221;;&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; $result=mysql_query($exec);<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; while($rs=mysql_fetch_object($result))<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; {<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; echo &#8220;username:&#8221;.$rs-&gt;username.&#8221;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; &#8220;;&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; }<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; ?&gt;&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u5f53\u7136\uff0c\u8868user\u4e2d\u6709\u4e00\u4e2ausername\u7684\u5b57\u6bb5\uff0c\u8fd9\u5c31\u7c7b\u4f3casp\u4e2d\u7684<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&lt;%<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">exec=&#8221;select * from user&#8221;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">set rs=server.createobject(&#8220;adodb.recordset&#8221;)&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">rs.open exec,conn,1,1<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">do while not rs.eof<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">response.write &#8220;username:&#8221;&amp;rs(&#8220;username&#8221;)&amp;&#8221;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&#8220;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">rs.movenext&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">loop&nbsp;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">%&gt;<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u5f53\u7136\u5148\u8981\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u4e00\u822c\u6211\u4eec require_once(&#8216;conn.php&#8217;);\u800cconn.php\u91cc\u9762\u5c31\u662f\u4e0a\u4e00\u6b21\u8bf4\u7684\u8fde\u63a5\u6570\u636e\u5e93\u7684\u4ee3\u7801\u3002<\/span><br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<br style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\" \/><br \/>\n<span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\">&nbsp; \u5c0f\u5c0f\u7684\u4e24\u6761\u547d\u4ee4\u53ef\u4ee5\u5b8c\u6210\u8bfb\u53d6\u6570\u636e\u7684\u5de5\u4f5c\u4e86\uff0c\u4eca\u5929\u8bf4\u5230\u8fd9\u91cc\u4e0b\u4e00\u6b21\u8bf4\u6570\u636e\u7684\u6dfb\u52a0\u5220\u9664\u4fee\u6539\u3002<\/span><span style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;background-color:#FBFBFB;\"><\/span><\/p>\n<p style=\"font-family:Simsun;font-size:14px;line-height:21.33333396911621px;white-space:normal;\">\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u76ee\u7684\uff1a\u5b66\u4f1a\u8bfb\u53d6\u6570\u636e &nbsp; \u5148\u770b\u4e24\u4e2a\u51fd\u6570\uff1a &nbsp; 1\u3001mysql_query&nbsp; &nbsp; \u9001\u51fa\u4e00\u4e2a query \u5b57\u7b26\u4e32\u3002 \u8bed\u6cd5: int mysql_query(string query, int [link_identifier]); \u8fd4\u56de\u503c: \u6574\u6570 &nbsp; \u672c\u51fd\u6570\u9001\u51fa query \u5b57\u7b26\u4e32\u4f9b MySQL \u505a\u76f8\u5173\u7684\u5904\u7406\u6216\u8005\u6267\u884c\u3002\u82e5\u6ca1\u6709\u6307\u5b9a link_ident [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[15],"tags":[],"class_list":["post-67","post","type-post","status-publish","format-standard","hentry","category-15"],"_links":{"self":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"wp:attachment":[{"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yptk.cn\/index.php\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}