{"id":30893,"date":"2017-06-21T03:01:40","date_gmt":"2017-06-20T17:01:40","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=30893"},"modified":"2017-06-21T06:54:58","modified_gmt":"2017-06-20T20:54:58","slug":"php-require-database-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-primer-tutorial\/","title":{"rendered":"PHP Require Database Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/using_php_database.php\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Require Database Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/using_php_database.jpg\" title=\"PHP Require Database Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">PHP Require Database Primer Tutorial<\/p><\/div>\n<p>Am wondering whether you were here when we introduced the concept of a PHP source file, on its own, acting like a web server residing database, by its mechanism of being able to update itself, yet, on an Apache\/PHP\/MySql web server arrangement, not easily be revealing that data to the general public, but to the user (equals computer\/web browser type combination) it will allow access, as exemplified by the tutorials within the tutorial blog posting thread involving <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/signature-signature-php-tutorial\/' title='Signature Signature PHP Tutorial'>Signature Signature PHP Tutorial<\/a>?<\/p>\n<p>Well, today we extend that thought just a little bit, by trying to create a &#8220;child&#8221; PHP source file scenario, that is called from a supervisor via &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='PHP header method' href='http:\/\/php.net\/manual\/en\/function.require.php'>require<\/a>('php_database.php');<br \/>\n<\/code><\/p>\n<p> &#8230; and then work off either &#8230;<\/p>\n<ul>\n<li>$_GET[] arguments and\/or &#8230;<\/li>\n<li>$_POST[] arguments<\/li>\n<\/ul>\n<p> &#8230; to store and recall &#8220;database&#8221; data stored within the bowels of the &#8220;child&#8221; PHP that has the capability of storing and updating this &#8220;database&#8221; data.<\/p>\n<p>In the industry you tend to hear about &#8220;database drivers&#8221; or &#8220;database engine&#8221;.  Well, today, we have those being just plain straight PHP code.  This interests me, but then, you know, those butterflies in Brazil changing the weather look interesting too &#8230; we hope you share this Latin Thang Going On &#8230; huh?!<\/p>\n<p>First thing with this project we researched was whether PHP&#8217;s <i>require<\/i> can take arguments.  We came out thinking, not except in some really kludgy fashion &#8230; and we&#8217;re not into fashion &#8230; so if we were cornered &#8230; alley fashion &#8230; moi &#8230; no.<\/p>\n<p>Before we go any further, you may have asked &#8220;why do this?&#8221;.  It strikes us that is quite a legitimate question, to which we&#8217;d answer, that we like ideas that &#8230;<\/p>\n<ul>\n<li>have a supervisory\/child relationship &#8230; and in so doing, for us &#8230;<\/li>\n<li>have us modularize PHP code in a way to make &#8220;the parts of the whole&#8221; logically smaller (and\/or logically belonging in &#8220;compartments of code&#8221;) &#8230; &#8220;logically&#8221; being the operative word &#8230; &#8220;why do it?&#8221; would be our ask of &#8220;illogical&#8221; (or arbitrary) approaches here<\/li>\n<\/ul>\n<p id='here'>So try today&#8217;s <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/using_php_database.php\" title=\"Click picture\">supervisor web application<\/a> (you could call <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/using_php_database.php_GETME\" title=\"using_php_database.php\">using_php_database.php<\/a>) (and you could try setting your own database stored recall value <a target=_blank style='text-decoration:underline;cursor:pointer;' onclick=\" var huh=prompt('Enter a value you want echoed back.  Saying nothing echoes back what you have entered here in the past.', ''); if (huh !=null) { window.open('https:\/\/www.rjmprogramming.com.au\/PHP\/using_php_database.php?val=' + huh,'_self');  }  \">via this<\/a> (to new window)) supervising our &#8220;child&#8221; (called via PHP <i>require<\/i>) <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/php_database.php_GETME\" title=\"php_database.php\">php_database.php<\/a> for our &#8220;PHP Source Code Database&#8221; concept today.<\/p>\n<p>As per usual, we give thanks to those geniuses on the WWW &#8230; today it&#8217;s &#8230; <a target=_blank href='https:\/\/stackoverflow.com\/questions\/1232097\/php-include-a-php-file-and-also-send-query-parameters' title='Useful link'>this useful link<\/a> &#8230; so &#8230; thanks.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d30893' onclick='var dv=document.getElementById(\"d30893\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/php\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d30893' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Am wondering whether you were here when we introduced the concept of a PHP source file, on its own, acting like a web server residing database, by its mechanism of being able to update itself, yet, on an Apache\/PHP\/MySql web &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[1835,299,932,997,2241,1319],"class_list":["post-30893","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-arguments","tag-database-2","tag-php","tag-programming","tag-require","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30893"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=30893"}],"version-history":[{"count":14,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30893\/revisions"}],"predecessor-version":[{"id":30913,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30893\/revisions\/30913"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=30893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=30893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=30893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}