{"id":947,"date":"2014-04-23T20:10:29","date_gmt":"2014-04-23T20:10:29","guid":{"rendered":"http:\/\/corbdesign.com\/blog\/?p=947"},"modified":"2014-04-23T20:10:29","modified_gmt":"2014-04-23T20:10:29","slug":"common-php","status":"publish","type":"post","link":"https:\/\/corbinrose.com\/blog\/technology\/common-php\/","title":{"rendered":"common php"},"content":{"rendered":"\n<p>Here are some of the common php things I use, and always have to look up:<\/p>\n\n\n\n<p>Mysql:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-lang=\"PHP\"><code>[php]\n$result = mysqli_query($con,&quot;SELECT * FROM Persons&quot;);&lt;\/code&gt;\n\n&lt;code&gt;while($row = mysqli_fetch_array($result)) {\necho $row[&#39;FirstName&#39;] . &quot; &quot; . $row[&#39;LastName&#39;];\necho &quot;\n&quot;;\n}\n[\/php]<\/code><\/pre><\/div>\n\n\n\n<p>Date:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-lang=\"PHP\"><code>[php]\n$today = date(&quot;F j, Y, g:i a&quot;); \/\/ March 10, 2001, 5:16 pm\n$today = date(&quot;m.d.y&quot;); \/\/ 03.10.01\n$today = date(&quot;j, n, Y&quot;); \/\/ 10, 3, 2001\n$today = date(&quot;Ymd&quot;); \/\/ 20010310\n$today = date(&#39;h-i-s, j-m-y, it is w Day&#39;); \/\/ 05-16-18, 10-03-01, 1631 1618 6 Satpm01\n$today = date(&#39;it is the jS day.&#39;); \/\/ it is the 10th day.\n$today = date(&quot;D M j G:i:s T Y&quot;); \/\/ Sat Mar 10 17:16:18 MST 2001\n$today = date(&#39;H:m:s m is month&#39;); \/\/ 17:03:18 m is month\n$today = date(&quot;H:i:s&quot;); \/\/ 17:16:18\n$today = date(&quot;Y-m-d H:i:s&quot;); \/\/ 2001-03-10 17:16:18 (the MySQL DATETIME format)\n[\/php]<\/code><\/pre><\/div>\n\n\n\n<p>Scan directory:<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-lang=\"PHP\"><code>[php]\n$myDirectory = opendir($where);\n\n\/\/ get each entry\nwhile($entryName = readdir($myDirectory)) {\nif ($entryName != &quot;.&quot; &amp;&amp; $entryName != &quot;..&quot;) {\n$dirArray[] = $entryName;\n}\n}\n\/\/ close directory\nclosedir($myDirectory);\n[\/php]<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here are some of the common php things I use, and always have to look up: Mysql: Date: Scan directory:<\/p>\n","protected":false},"author":2,"featured_media":5538,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[28,17],"tags":[],"class_list":["post-947","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-technology","clearfix","post-index"],"acf":[],"jetpack_featured_media_url":"https:\/\/corbinrose.com\/blog\/wp-content\/uploads\/2014\/04\/php-leader-2.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/posts\/947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/comments?post=947"}],"version-history":[{"count":0,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/posts\/947\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/media\/5538"}],"wp:attachment":[{"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/media?parent=947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/categories?post=947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/corbinrose.com\/blog\/wp-json\/wp\/v2\/tags?post=947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}