{"id":108,"date":"2012-11-08T12:45:38","date_gmt":"2012-11-08T04:45:38","guid":{"rendered":"http:\/\/www.yeetrack.com\/post\/2012-11-08\/php%25E5%2588%259B%25E5%25BB%25BA%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593%25E5%2592%258C%25E8%25A1%25A8"},"modified":"2013-04-20T17:28:54","modified_gmt":"2013-04-20T09:28:54","slug":"php%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae%e5%ba%93%e5%92%8c%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=108","title":{"rendered":"php\u521b\u5efa\u6570\u636e\u5e93\u548c\u8868"},"content":{"rendered":"<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;php\u7528CREATE DATABASE \u8bed\u53e5\u6765\u521b\u5efa\u6570\u636e\u5e93\u3002<\/p>\n<p><!--more--><\/p>\n<p>mysql_query\u51fd\u6570\u7528\u6765\u6267\u884csql\u8bed\u53e5\u3002\u5982\u4e0b\uff1a<\/p>\n<pre config=\"brush:php;toolbar:false;\">&lt;?php \n$link = mysql_connect('localhost','root','toor'); \nif (!$link) { \n        die('Could not connect to MySQL: ' . mysql_error()); \n} \nif(mysql_query(&quot;CREATE DATABASE mydatabase&quot;, $link))\n        echo &quot;\u6570\u636e\u5e93\u521b\u5efa\u6210\u529f&quot;;\nelse\n        echo &quot;\u6570\u636e\u5e93\u521b\u5efa\u5931\u8d25, &quot; . mysql_error();\n       \nmysql_close($link); \n?&gt;<\/pre>\n<p>php\u7528CREATE TABLE\u8bed\u53e5\u6765\u521b\u5efa\u8868:<\/p>\n<pre config=\"brush:php;toolbar:false;\">&lt;?php \n$link = mysql_connect('localhost','root','toor'); \nif (!$link) { \n        die('Could not connect to MySQL: ' . mysql_error()); \n} \nif(mysql_query(&quot;CREATE DATABASE mydatabase&quot;, $link))\n        echo &quot;\u6570\u636e\u5e93\u521b\u5efa\u6210\u529f&quot;;\nelse\n        echo &quot;\u6570\u636e\u5e93\u521b\u5efa\u5931\u8d25, &quot; . mysql_error();\n             \nmysql_select_db(&quot;mydatabase&quot;,$link);\/\/\u9009\u62e9\u6570\u636e\u5e93\uff0c\u76f8\u5f53\u4e8esql\u8bed\u53e5use mydatabase;\n     \n\/\/\u521b\u5efa\u8868\u7684\u8bed\u53e5\n$sql=&quot;CREATE TABLE  user   \n( username varchar(20),\n  password varchar(20),\n  email varchar(20)\n)&quot;;\n     \nif(mysql_query($sql,$link)) \/\/\u6267\u884csql\u547d\u4ee4\n        echo &quot;\u8868\u521b\u5efa\u6210\u529f&quot;;\nelse\n        echo &quot;\u8868\u521b\u5efa\u5931\u8d25&quot; . mysql_error();\n     \nmysql_close($link); \n?&gt;<\/pre>\n<p>\u5176\u5b9e$sql\u5c31\u662f\u4fdd\u5b58\u7684\u6b63\u5e38\u7684sql\u8bed\u53e5\uff0c\u4ea4\u7ed9mysql_query()\u53bb\u63d0\u4ea4\u6570\u636e\u5e93\u6267\u884c\u3002<\/p>\n<pre config=\"brush:php;toolbar:false;\">$sql = &quot;CREATE TABLE user\n(\nuserId int NOT NULL AUTO_INCREMENT, \nPRIMARY KEY(userId),\nusername varchar(20),\npassword varchar(20),\nemail varchar(20)\n)&quot;;\nmysql_query($sql,$con);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;php\u7528CREATE DATABASE \u8bed\u53e5\u6765\u521b\u5efa\u6570\u636e\u5e93\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[33],"tags":[24,7],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-coding","tag-php","tag-7"],"views":2792,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=108"}],"version-history":[{"count":2,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":419,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions\/419"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}