{"id":586,"date":"2024-05-07T23:07:03","date_gmt":"2024-05-07T23:07:03","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=586"},"modified":"2024-05-08T01:34:52","modified_gmt":"2024-05-08T01:34:52","slug":"php-data-listlist01-php","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2024\/05\/07\/php-data-listlist01-php\/","title":{"rendered":"[PHP]\ub370\uc774\ud130\ub9ac\uc2a4\ud2b8 DATA LIST(list01.php)"},"content":{"rendered":"\n<p>list01.php\ud30c\uc77c\uc758 \uc18c\uc2a4\ucf54\ub4dc \uc785\ub2c8\ub2e4.<br>\uc785\ub825\ub41c \ub370\uc774\ud130\ub97c \ubcf4\uc5ec\uc8fc\ub294 \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>\ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc811\uc18d,\uc778\uc99d \ubd80\ubd84\uc740 \uae30\uc874 \ubd80\ubd84\uacfc \ub3d9\uc77c \ud569\ub2c8\ub2e4.<br>\uc790\uc138\ud788 \uc0b4\ud3b4\ubd10\uc57c \ub420 \ubd80\ubd84\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<p>This is the source code of the list01.php file.<br>This part shows the entered data.<br>The database connection and authentication parts are the same as the existing parts.<br>Here are some things to look at in detail<\/p>\n\n\n\n<p><strong>1.SQL QUERY<\/strong><br>testuser \ud14c\uc774\ube14\uc5d0\uc11c id\ud544\ub4dc\ub97c \uae30\uc900\uc73c\ub85c \ub0b4\ub9bc\ucc28\uc900 \uc815\ub82c\ud558\uace0 10\uac1c\uc758 \uac8c\uc2dc\ubb3c\uc744  0\ubc88\uc9f8 \ub2e4\uc74c\ubd80\ud130 \uac80\uc0c9\ud569\ub2c8\ub2e4.<br>Sort the testuser table in descending order based on the id field and search for the 10 posts starting from 0.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   $sql = \"select * from testuser order by id desc limit 10 offset 0\";\n   $result = $mysqli-&gt;query($sql);<\/code><\/pre>\n\n\n\n<p><strong>2.$row = $result-&gt;fetch_assoc()<\/strong><br>\uc2e4\ud589\ub41c \uacb0\uacfc\ub97c \ubc30\uc5f4\ub85c \uac00\uc9c0\uace0 \uc640\uc11c \ud654\uba74\uc5d0 \ucd9c\ub825\ud569\ub2c8\ub2e4.<br>Runs the results and displays them on the screen.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   while($row = $result-&gt;fetch_assoc()){\n    $r_id     = $row&#91;'id']; \n    $r_name   = $row&#91;'name'];\n    $r_title  = $row&#91;'title'];\n\n    echo \"&lt;tr&gt;&lt;td&gt;\" . $r_id . \"&lt;\/td&gt;&lt;td&gt;\" . $r_name . \"&lt;\/td&gt;&lt;td&gt;\" . $r_title . \"&lt;\/td&gt;&lt;\/tr&gt;\";\n    \n   }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n    &lt;head&gt;\n    \u200b  &lt;title&gt;List\ud30c\uc77c&lt;\/title&gt;\n        &lt;!--\uc774 \ubd80\ubd84\uc740 html\ucf54\uba58\ud2b8 \uc601\uc5ed This part is the html comment area,\ub9c8\uc784\ud0c0\uc785\uc124\uc815 Mime type settings\/\/--&gt;\n      &lt;meta charset=\"utf-8\"&gt;\n      &lt;!-- \ubaa8\ubc14\uc77c\ud3f0 \uc2a4\ud06c\ub9b0 \uc635\uc158 Mobile phone screen options\/\/--&gt;\n      &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\n      &lt;!--\ubd80\ud2b8\uc2a4\ud2b8\ub7a95 CDN\ubc29\uc2dd \ub9c1\ud06c Bootstrap 5 CDN method link\/\/--&gt;\n      &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n      &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/js\/bootstrap.bundle.min.js\"&gt;&lt;\/script&gt;\n\n   &lt;\/head&gt;\n   &lt;body&gt;\n&lt;!--\ud14c\uc774\ube14 \uc2dc\uc791 table start \/\/--&gt;\n&lt;div class=\"container mt-3\"&gt;\n  &lt;table class=\"table table-dark table-hover\"&gt;\n   &lt;tr&gt;\n      &lt;td&gt;ID&lt;\/td&gt;&lt;td&gt;\uc774\ub984&lt;\/td&gt;&lt;td&gt;\uc81c\ubaa9&lt;\/td&gt;\n   &lt;\/tr&gt;\n&lt;?php\n   \/\/\ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc778\uc99d\n   \/\/DATABASE AUTENTICATION\n   $servername = \"localhost\";\n   $username = \" \";\n   $password = \" \";\n   $dbname = \" \";\n\n   \/\/\ub370\uc774\ud130 \ubca0\uc774\uc2a4 \uc811\uc18d \n   \/\/DATABASE CONNECTION\n   $mysqli = new mysqli($servername,$username,$password,$dbname);\n   \n   \/\/\ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc811\uc18d\uccb4\ud06c\n   \/\/DATABASE CONNECTION CHECK\n   if($mysqli-&gt;connect_error){\n      die(\"connect failed\". $mysqli-&gt;connect_error);\n   \n   }\n   \/\/ SQL QUERY\n   $sql = <mark style=\"background-color:rgba(0, 0, 0, 0);color:#a51515\" class=\"has-inline-color\">\"select * from testuser order by id desc limit 10 offset 0\";<\/mark>\n   $result = $mysqli-&gt;query($sql);\n   while(<mark style=\"background-color:rgba(0, 0, 0, 0);color:#901ec9\" class=\"has-inline-color\">$row = $result-&gt;fetch_assoc()<\/mark>){\n    $r_id     = $row&#91;'id']; \n    $r_name   = $row&#91;'name'];\n    $r_title  = $row&#91;'title'];\n\n    echo \"&lt;tr&gt;&lt;td&gt;\" . $r_id . \"&lt;\/td&gt;&lt;td&gt;\" . $r_name . \"&lt;\/td&gt;&lt;td&gt;\" . $r_title . \"&lt;\/td&gt;&lt;\/tr&gt;\";\n    \n   }\n\n   $mysqli-&gt;close();\n?&gt;\n      &lt;tr&gt;\n         &lt;td colspan=3&gt;&lt;a href=\"form6.php\"&gt;write&lt;\/a&gt;&lt;\/td&gt;\n      &lt;\/tr&gt;\n   &lt;\/table&gt;\n&lt;\/div&gt;\n&lt;!--\ud14c\uc774\ube14 \ub05dtable end\/\/--&gt;\n   &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\uc544\ub798\uc758 \ub9c1\ud06c\ub97c \ud1b5\ud574\uc11c \ud14c\uc2a4\ud2b8 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4<br>You can test it through the link below<br><a rel=\"noreferrer noopener\" href=\"https:\/\/freelifemakers.org\/lec\/list01.php\" target=\"_blank\">https:\/\/freelifemakers.org\/lec\/list01.php<\/a><\/p>\n\n\n\n<iframe loading=\"lazy\" src=\"https:\/\/www.facebook.com\/plugins\/video.php?height=476&#038;href=https%3A%2F%2Fwww.facebook.com%2Fgideonslife01%2Fvideos%2F961574962130705%2F&#038;show_text=false&#038;width=267&#038;t=0\" width=\"267\" height=\"476\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowfullscreen=\"true\" allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\" allowFullScreen=\"true\"><\/iframe>\n","protected":false},"excerpt":{"rendered":"<p>list01.php\ud30c\uc77c\uc758 \uc18c\uc2a4\ucf54\ub4dc \uc785\ub2c8\ub2e4.\uc785\ub825\ub41c \ub370\uc774\ud130\ub97c \ubcf4\uc5ec\uc8fc\ub294 \ubd80\ubd84\uc785\ub2c8\ub2e4.\ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc811\uc18d,\uc778\uc99d \ubd80\ubd84\uc740 \uae30\uc874 \ubd80\ubd84\uacfc \ub3d9\uc77c \ud569\ub2c8\ub2e4.\uc790\uc138\ud788 \uc0b4\ud3b4\ubd10\uc57c \ub420 \ubd80\ubd84\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. This is the source code of the list01.php file.This part shows the entered data.The database connection and authentication parts are the same as the existing parts.Here are some things to look at in detail 1.SQL QUERYtestuser \ud14c\uc774\ube14\uc5d0\uc11c id\ud544\ub4dc\ub97c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-586","post","type-post","status-publish","format-standard","hentry","category-php","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=586"}],"version-history":[{"count":9,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/586\/revisions"}],"predecessor-version":[{"id":596,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/586\/revisions\/596"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}