{"id":1687,"date":"2024-06-18T12:40:50","date_gmt":"2024-06-18T16:40:50","guid":{"rendered":"https:\/\/www.survivorlibrary.com\/?page_id=1687"},"modified":"2024-06-26T08:45:34","modified_gmt":"2024-06-26T12:45:34","slug":"checkforbooks","status":"publish","type":"page","link":"https:\/\/www.survivorlibrary.com\/index.php\/checkforbooks\/","title":{"rendered":"Check for Books"},"content":{"rendered":"<p>\/\/ Simulated form input for the example $year = 2023; $month = &#8217;05&#8217;; \/\/ Concatenate into yyyy-mm-01 $date = $year . &#8216;-&#8216; . $month . &#8216;-01&#8217;; \/\/ Example database query $mysqli = new mysqli(&#8220;localhost&#8221;, &#8220;username&#8221;, &#8220;password&#8221;, &#8220;database&#8221;); if ($mysqli-&gt;connect_error) { die(&#8220;Connection failed: &#8221; . $mysqli-&gt;connect_error); } $sql = &#8220;SELECT * FROM example WHERE date_column = &#8216;$date'&#8221;; $result = $mysqli-&gt;query($sql); if ($result-&gt;num_rows &gt; 0) { while ($row = $result-&gt;fetch_assoc()) { echo &#8220;id: &#8221; . $row[&#8220;id&#8221;] . &#8221; &#8211; Data: &#8221; . $row[&#8220;data&#8221;] . &#8220;&#8221;; } } else { echo &#8220;0 results&#8221;; } $mysqli-&gt;close(); \/\/ Example URL $url = &#8220;http:\/\/example.com\/do_thing_with_date.php?date=&#8221; . urlencode($date); echo $url;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ Simulated form input for the example $year = 2023; $month = &#8217;05&#8217;; \/\/ Concatenate into yyyy-mm-01 $date = $year . &#8216;-&#8216; . $month . &#8216;-01&#8217;; \/\/ Example database query $mysqli = new mysqli(&#8220;localhost&#8221;, &#8220;username&#8221;, &#8220;password&#8221;, &#8220;database&#8221;); if ($mysqli-&gt;connect_error) { &hellip; <a href=\"https:\/\/www.survivorlibrary.com\/index.php\/checkforbooks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[42],"tags":[],"class_list":["post-1687","page","type-page","status-publish","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/pages\/1687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/comments?post=1687"}],"version-history":[{"count":20,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/pages\/1687\/revisions"}],"predecessor-version":[{"id":1714,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/pages\/1687\/revisions\/1714"}],"wp:attachment":[{"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/media?parent=1687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/categories?post=1687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.survivorlibrary.com\/index.php\/wp-json\/wp\/v2\/tags?post=1687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}