{"id":844,"date":"2011-05-16T13:46:42","date_gmt":"2011-05-16T04:46:42","guid":{"rendered":"http:\/\/www.myu-zin.com\/webridge\/?p=844"},"modified":"2011-05-16T15:15:40","modified_gmt":"2011-05-16T06:15:40","slug":"mysql%e3%81%ab%e3%83%90%e3%82%a4%e3%83%8a%e3%83%aa%e3%81%a7%e6%a0%bc%e7%b4%8d%e3%81%95%e3%82%8c%e3%81%9f%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e7%94%bb%e5%83%8f%ef%bc%88id%e5%90%8d-jpeg%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.myu-zin.com\/webridge\/archives\/844.html","title":{"rendered":"MySQL\u306b\u30d0\u30a4\u30ca\u30ea\u3067\u683c\u7d0d\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u753b\u50cf\uff08ID\u540d.jpeg\uff09\u3067\u8868\u793a\u3055\u305b\u308b"},"content":{"rendered":"<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08MySQL\uff09\u306b\u683c\u7d0d\u3055\u308c\u305f\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\uff08.jpeg\uff09\u3068\u3057\u3066\u51fa\u529b\u3057\u8868\u793a\u3055\u305b\u308b\u4ed5\u7d44\u307f\u3092PHP\u3067\u4f5c\u308a\u307e\u3059\u3002<br \/>\nPHP\u306f\u52c9\u5f37\u4e2d\u306e\u305f\u3081\u3001\u52b9\u7387\u7684\u306a\u65b9\u6cd5\u304b\u3069\u3046\u304b\u306f\u5fae\u5999\u3067\u3059\u304c\u3001\u81ea\u529b\u3067\u65b9\u6cd5\u3092\u63a2\u3057\u9054\u6210\u3057\u305f\u65b9\u6cd5\u306a\u306e\u3067\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u8a18\u9332\u3057\u307e\u3059\u3002<br \/>\n\u9054\u8005\u306a\u65b9\u304b\u3089\u306e\u6539\u5584\u30b3\u30e1\u30f3\u30c8\u3092\u304a\u5f85\u3061\u3057\u3066\u307e\u3059\u3002<\/p>\n<h4>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u4f8b<\/h4>\n<table>\n<tbody>\n<tr>\n<th>id<\/th>\n<th>data<\/th>\n<th>update<\/th>\n<\/tr>\n<tr>\n<td><span style=\"color: #ff0000;\">WZaTlwQhnt4fUfm<\/span><\/td>\n<td>[BLOB &#8211; 2.3   MiB]<\/td>\n<td>2009-04-20 20:07:54<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #ff0000;\">BMJWn9a2ak3GGAf1<\/span><\/td>\n<td>[BLOB &#8211; 4.0   MiB]<\/td>\n<td>2009-04-20 20:07:54<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #ff0000;\">oZqqwIiFmONHh5<\/span><\/td>\n<td>[BLOB &#8211; 2.5   MiB]<\/td>\n<td>2009-04-20 20:07:54<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>picture_list.php<\/h3>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u3042\u308b\u5168\u3066\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u4e00\u89a7\u3092\u4f5c\u6210\u3057\u3066\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306b\u30ea\u30f3\u30af\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\n\r\n&lt;html&gt;\r\n&lt;head&gt;&lt;title&gt;\u5199\u771f\u8868\u793a&lt;\/title&gt;&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;\u5199\u771f\u8868\u793a&lt;\/h1&gt;\r\n\r\n&lt;?php\r\n\/\/MySQL\u306b\u63a5\u7d9a\r\n$dbc=mysql_connect(&quot;localhost&quot;,&quot;user(\u30e6\u30fc\u30b6\u30fc\u540d)&quot;,&quot;123456(\u30d1\u30b9\u30ef\u30fc\u30c9)&quot;) or die(&quot;MySQL\u63a5\u7d9a\u5931\u6557 :&quot;.mysql_error());\r\n\r\n\/\/\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\r\nmysql_select_db(&quot;photo(\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d)&quot;);\r\n\r\n\/\/\u300cli_image\u300d\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306e\u3001ID\u9078\u629e\u3059\u308b\r\n$sql=&quot;SELECT id FROM li_image&quot;;\r\n$res=mysql_query($sql,$dbc);\r\n\r\n\u53d6\u5f97\u3057\u305f\u914d\u5217\u3092\u8868\u793a\u3059\u308b\r\nwhile($dat=mysql_fetch_array($res,MYSQL_NUM)){\r\n\r\n\/\/\u52d5\u7684URL\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5834\u5408\r\n\/\/\tprint '&lt;a href=&quot;picture_view.php?id='.$dat&#x5B;0].'&quot;&gt;';\r\n\r\n\/\/.htaccess\u3067\u9759\u7684URL\u306b\u30ea\u30cd\u30fc\u30e0\u3055\u308c\u305fURL\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5834\u5408\r\n\tprint '&lt;a href=&quot;'.$dat&#x5B;0].'.jpeg&quot;&gt;';\r\n\tprint $dat&#x5B;0] .&quot;\u3000\u306e\u753b\u50cf&quot;;\r\n\tprint '&lt;\/a&gt;&lt;br \/&gt;' ;\r\n\r\n}\r\nmysql_free_result($res);\r\n?&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\r\n<\/pre>\n<h3>picture_view.php<\/h3>\n<p>\u6b21\u306b\u4e0a\u8a18\u3067\u4f5c\u6210\u3057\u305fpicture_list.php\u304b\u3089\u30ea\u30f3\u30af\u3055\u308c\u305f\u969b\u306b<br \/>\nhttp:\/\/localhost\/picture_view.php?id=<span style=\"color: #ff0000;\">WZaTlwQhnt4fUfm<\/span><br \/>\n\u3068\u3044\u3046\u3088\u3046\u306aid\u4ed8\u304dURL\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068id\u306e\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/p>\n<pre class=\"brush: php; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\n\r\n&lt;?php\r\n\/\/Content-Type\u3092\u6307\u5b9a\r\nheader(&quot;Content-Type: image\/jpeg&quot;);\r\n\r\n\/\/MySQL\u306b\u63a5\u7d9a\r\n$db \u00a0= mysql_connect( 'localhost' \u00a0, 'user(\u30e6\u30fc\u30b6\u30fc\u540d)' , '123456(\u30d1\u30b9\u30ef\u30fc\u30c9)' );\r\n\r\n\/\/\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\r\n$dbh = mysql_selectdb( 'photo(\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d)' ,$db );\r\n\r\n\/\/\u300cli_image\u300d\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306e\u3001\u6307\u5b9a\u3055\u308c\u305fID\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u9078\u629e\u3059\u308b\r\n$sth \u00a0= mysql_query ( &quot;SELECT * FROM li_image WHERE id='{$_REQUEST&#x5B;'id']}'&quot;, $db );\r\n\r\n\/\/2 \u756a\u76ee\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092 MYSQL_ASSOC \u306b\u6307\u5b9a\u3057\u3066\u30b3\u30fc\u30eb\u3059\u308b\r\n$result = mysql_fetch_assoc( $sth );\r\nprint $result&#x5B;'data'];\r\n?&gt;\r\n\r\n<\/pre>\n<h3>.htaccess\u3067\u52d5\u7684\u30da\u30fc\u30b8\u3092\u9759\u7684\u30da\u30fc\u30b8\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b<\/h3>\n<p>\u300chttp:\/\/localhost\/picture_view.php?id=WZaTlwQhnt4fUfm\u300d\u306a\u3069\u306e\u52d5\u7684\u306aURL\u3092\u300chttp:\/\/localhost\/WZaTlwQhnt4fUfm.jpeg\u300d\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\nRewriteEngine On\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^(.*)\\.jpeg$ picture_view.php?id=$1 &#x5B;L]\r\n<\/pre>\n<p>1\u884c\u76ee\u306f\u3001\u66f8\u304d\u63db\u3048\u6a5f\u80fd\u3092ON\u3068\u3044\u3046\u610f\u5473\u3002<br \/>\n2\u884c\u76ee\uff5e3\u884c\u76ee\u306f\u3001\u5b9f\u969b\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308c\u3070\u66f8\u304d\u63db\u3048\u306f\u5b9f\u884c\u3057\u306a\u3044\u3068\u3044\u3046\u610f\u5473\u3002<br \/>\n4\u884c\u76ee\u306f\u3001\u6b63\u898f\u8868\u73fe\u3067\u66f8\u304b\u308c\u305f\u66f8\u304d\u63db\u3048\u898f\u5247\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08MySQL\uff09\u306b\u683c\u7d0d\u3055\u308c\u305f\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[65,74,43],"tags":[77,76],"class_list":["post-844","post","type-post","status-publish","format-standard","hentry","category-php","category-74","category-43","tag-mysql","tag-76"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":14,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":872,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/844\/revisions\/872"}],"wp:attachment":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}