{"id":96626,"date":"2020-04-21T11:41:38","date_gmt":"2020-04-21T03:41:38","guid":{"rendered":"http:\/\/4563.org\/?p=96626"},"modified":"2020-04-21T11:41:38","modified_gmt":"2020-04-21T03:41:38","slug":"%e8%af%b7%e6%95%99%e5%a4%a7%e4%bd%ac%e4%b8%80%e4%b8%aa-php-%ef%bc%8c-mysql-%e6%9f%a5%e8%af%a2%e5%9c%a8%e5%89%8d%e7%ab%af%e6%98%be%e7%a4%ba%e7%9a%84%e9%97%ae%e9%a2%98%e3%80%82","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=96626","title":{"rendered":"\u8bf7\u6559\u5927\u4f6c\u4e00\u4e2a PHP \uff0c MYSQL \u67e5\u8be2\u5728\u524d\u7aef\u663e\u793a\u7684\u95ee\u9898\u3002"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u5927\u4f6c\u4e00\u4e2a PHP \uff0c MYSQL \u67e5\u8be2\u5728\u524d\u7aef\u663e\u793a\u7684\u95ee\u9898\u3002               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : IDCFAN <\/span>  <span><i><\/i> 63<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>#####\u83dc\u903c\u8def\u8fc7 \u8bf7\u591a\u591a\u6307\u6559 \u8c22\u8c22\u5566 :tw-1f602:<\/p>\n<h6>\u5c31\u662f\u60f3\u7528 PHP \u67e5\u8be2\u4e0b\u8868\uff08 MYSQL \uff09\u7684\u6570\u636e\u5e76\u6309 group \u503c\u6765\u5728\u524d\u53f0\u663e\u793a\u5185\u5bb9\uff0c\u5e0c\u671b\u6709\u7a7a\u7684\u5927\u4f6c\u80fd\u5e2e\u5199\u4e0b\u67e5\u8be2\u548c\u524d\u53f0\u663e\u793a\u7684 PHP \u8bed\u53e5\u3002<\/h6>\n<p>#####MYSQL \u8868\u7ed3\u6784\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200520_5ec534545574d.jpg\" title=\"table\" alt=\"\u8bf7\u6559\u5927\u4f6c\u4e00\u4e2a PHP \uff0c MYSQL \u67e5\u8be2\u5728\u524d\u7aef\u663e\u793a\u7684\u95ee\u9898\u3002\" \/><\/p>\n<p>#####\u524d\u53f0\u5e0c\u671b\u7684\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200520_5ec53455f3094.jpg\" title=\"table\" alt=\"\u8bf7\u6559\u5927\u4f6c\u4e00\u4e2a PHP \uff0c MYSQL \u67e5\u8be2\u5728\u524d\u7aef\u663e\u793a\u7684\u95ee\u9898\u3002\" \/><\/p>\n<p>######\u5982\u679c\u5927\u4f6c\u89c9\u5f97\uff1a\u4f60\u4e2a\u83dc\u903c\uff0c\u8fd9\u5165\u95e8\u7684\u4e1c\u897f\u81ea\u5df1\u770b\u4e24\u773c\u6559\u7a0b\u5c31\u4f1a\u4e86\u3002\u6211\u89e3\u91ca\u4e00\u4e0b\u4e8b\u60c5\u662f\u8fd9\u6837\u7684\uff0c\u6211\u5e73\u5e38\u662f\u5f00\u5e97\u5356\u714e\u997c\u679c\u5b50\uff0c\u8089\u5939\u998d\u8fd8\u6709\u9e21\u86cb\u704c\u997c\uff0c\u8c46\u6d46\u4ec0\u4e48\u7684\uff0c\u5f88\u5fd9\u5f88\u7d2f\u3002\u7a7a\u5e8a\u65f6\u95f4\u5b66\u4e86 HTML\uff0cCSS\uff0cJS \u8fd8\u6ca1\u53ea\u770b\u4e86\u51e0\u773c\u5165\u95e8\u6559\u7a0b\uff0c\u540e\u7aef\u8bed\u8a00\u66f4\u662f\u6ca1\u600e\u4e48\u63a5\u89e6\u3002\u4f46\u662f\u4eca\u5929\u665a\u4e0a\u8bf7\u6559\u7684\u8fd9\u4e2a\u8981\u4eca\u5929\u665a\u4e0a\u60f3\u7528\u8d77\u6765\uff0c\u6240\u4ee5\u62c9\u4e0b\u8138\u6765\u8fd9\u91cc\u505a\u4f38\u624b\u515a\u4e86\u3002:tw-1f605:<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>13<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"877464\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iConsLii <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u7528 MySQL \u7684 group by \u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877465\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : IDCFAN <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @iConsLii \u8c22\u8c22\u5566\uff0c\u6211\u53bb\u770b\u770b group by \u7684\u4f7f\u7528\uff0c\u7f9e\u6127\u7684\u8bf4\uff0c\u4e0d\u4ec5\u4ec5\u662f\u60f3\u5927\u5bb6\u63d0\u4f9b\u65b9\u6cd5\uff0c\u66f4\u5e0c\u671b\u5927\u4f6c\u80fd\u76f4\u63a5\u7ed9\u51fa code \uff1a\uff09~~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877466\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gtchan13579 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &lt;?php<br \/>$servername = &#8220;mysql \u670d\u52a1\u5668 ip&#8221;;<br \/>$username = &#8220;\u8d26\u53f7&#8221;;<br \/>$password = &#8220;\u5bc6\u7801&#8221;;<br \/>$dbname = &#8220;\u6570\u636e\u5e93&#8221;;<br \/>$conn = new mysqli($servername, $username, $password, $dbname);<br \/>if (!$conn) {<br \/> die(&#8220;Connection failed: &#8221; . mysqli_connect_error());<br \/>}<br \/>$sql = &#8220;SELECT name FROM \u8868\u540d WHERE group==1&#8221;;<br \/>$result = mysqli_query($conn, $sql);<\/p>\n<p>while($row = mysqli_fetch_array($result))<br \/>{<br \/>echo &#8220;&#8221;.$row[&#8216;name];<br \/>echo &#8220;&lt;br&gt;&#8221;;<br \/>}<br \/>?&gt;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877467\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Vhc001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e5f\u662f\u66fe\u7ecf\u4e1a\u4f59\u65f6\u95f4\u81ea\u5b66\u7684\u7f16\u7a0b\uff0c\u6df1\u77e5\u5176\u4e2d\u7684\u4e0d\u6613\u3002\u4e3b\u8981\u4e0d\u52a0\u4e2a\u5fae\u4fe1\u4ea4\u6d41\u4ea4\u6d41\uff1f<br \/>https:\/\/pastebin.com\/ELVRZbHk                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877468\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : IDCFAN <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gtchan13579 \u5927\u4f6c\u8c22\u8c22\u3002\u518d\u591a\u95ee\u4e00\u4e0b\uff0c\u8fd9\u6837\u7684\u8bdd\uff0c\u8981\u663e\u793a\u5b8c\u4e09\u4e2a\u7ec4\uff0c\u5f97\u67e5\u8be2\u4e09\u6b21\u6570\u636e\u5e93\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877469\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : IDCFAN <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Vhc001 \u8c22\u8c22\u5927\u4f6c\uff0c\u6211\u73b0\u5728\u95e8\u513f\u9ed1\uff0c\u5565\u4e5f\u4e0d\u4f1a\uff0c\u4e5f\u4e0d\u77e5\u9053\u804a\u5565\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877470\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Vhc001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u597d\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877471\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : msg7086 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u67e5\u5168\u8868\u56de\u6765\u524d\u7aef\u5206\u7ec4\u3002<br \/>\u5b66\u7f16\u7a0b\u8fd8\u662f\u5efa\u8bae\u81ea\u5df1\u6162\u6162\u5b66\uff0c\u5982\u679c\u8981\u6025\u7740\u7528\u4e1c\u897f\uff0c\u5efa\u8bae\u96c7\u4eba\u6765\u505a\u3002\u4f60\u81ea\u5df1\u8fd9\u4e48\u641e\uff0c\u7f51\u7ad9\u8fc7\u4e24\u5929\u88ab\u4eba\u9ed1\u4e86\u90a3\u5c31\u597d\u73a9\u4e86\uff0c\u7279\u522b\u662f\u4f60\u8fd9\u4e2a\u53e4\u5178\u5199\u6cd5\uff08\u5feb 20 \u5e74\u524d\u7684\u98ce\u683c\uff09\uff0c\u4e0d\u88ab\u4eba\u9ed1\u6389\u6211\u90fd\u89c9\u5f97\u5947\u602a\u3002<br \/>\u5982\u679c\u771f\u7684\u60f3\u8981\u591a\u5b66\u4e00\u95e8\u624b\u827a\uff0c\u90a3\u5c31\u8ba4\u8ba4\u771f\u771f\u597d\u597d\u5b66\uff0c\u4e0d\u8981\u8d70\u6377\u5f84\uff0c\u8fd9\u4e1c\u897f\u6ca1\u6709\u6377\u5f84\u3002<br \/>\u8981\u5b66 PHP \u53ef\u4ee5\u5b66\u5b8c\u7f16\u7a0b\u57fa\u7840\u4ee5\u540e\u62ff\u672c PHP \u7684\u4e66\u6765\u5543\uff0c\u6700\u597d\u662f\u56fd\u5916\u4e66\u7c4d\u7684\u4e2d\u6587\u8bd1\u672c\uff08\u80fd\u76f4\u63a5\u770b\u5916\u8bed\u66f4\u597d\uff09\u3002<\/p>\n<p>\u4f60\u8bf4\u7684\u8fd9\u4e2a\u6d89\u53ca\u5230\u4e00\u4e9b\u7b80\u5355\u7684\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\u3002<br \/>\u5206\u7ec4\u9700\u8981\u8dd1\u5faa\u73af\u7136\u540e\u628a\u6570\u636e\u63d2\u5165\u4e00\u4e2a\u5206\u7ec4\u6570\u7ec4\u91cc\uff0c\u6700\u540e\u4f1a\u53d8\u6210\u4e00\u4e2a\u4e8c\u7ef4\uff08\u6216\u8005\u8bf4\u4e8c\u9636\uff09\u6570\u7ec4\uff0c\u5916\u5c42\u662f\u7ec4\uff0c\u5185\u5c42\u662f\u9879\u76ee\uff0c\u518d\u91cc\u9762\u662f\u5bf9\u8c61\uff08 PHP \u91cc\u5219\u662f\u53c8\u4e00\u5c42\u5173\u8054\u6570\u7ec4\uff09\u3002<\/p>\n<p>\u4e0a\u9762\u8bf4\u7684 GROUP BY \u662f\u4e0d\u9002\u5408\u4f60\u8981\u7684\u6548\u679c\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877472\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tonytonychopper <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u65e9\u9910\u5e97\u5e97\u8001\u677f\u90fd\u5728\u5b66\u7f16\u7a0b\uff0c\u4f60\u51ed\u4ec0\u4e48\u4e0d\u52aa\u529b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877473\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : IDCFAN <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @msg7086                                                             <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877474\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liprais <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5173\u952e\u8bcd group by concat<br \/>\u4e0a\u9762\u8bf4\u505a\u4e0d\u5230\u7684\u5b9e\u5728\u641e\u7b11\u4e48                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877475\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangyzj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u76f4\u63a5\u90fd\u67e5\u51fa\u6765<br \/>\u7136\u540e\u6e32\u67d3\u5217\u8868\u7684\u65f6\u5019\u6839\u636e\u7ec4\u540d\u5224\u65ad\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"877476\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : myEzekiel <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             echo \u8f93\u51fa                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u5927\u4f6c\u4e00\u4e2a PHP \uff0c MYSQ&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/96626"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96626"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/96626\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96626"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}