{"id":30926,"date":"2017-06-23T03:01:30","date_gmt":"2017-06-22T17:01:30","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=30926"},"modified":"2017-06-22T22:51:49","modified_gmt":"2017-06-22T12:51:49","slug":"php-require-database-histogram-tallying-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-histogram-tallying-tutorial\/","title":{"rendered":"PHP Require Database Histogram Tallying Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/HistogramChart\/histogram_chart.php?justmenu=justmenu\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Require Database Histogram Tallying Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/applying_ht_php_database.jpg\" title=\"PHP Require Database Histogram Tallying Tutorial\" \/><\/a><p class=\"wp-caption-text\">PHP Require Database Histogram Tallying Tutorial<\/p><\/div>\n<p>The &#8220;PHP Require Database&#8221; concept of yesterday, with <a title='PHP Require Database Application Tutorial' href='#prdat'>PHP Require Database Application Tutorial<\/a>, opens the way for more <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/index' title='Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.'>Google Chart<\/a> &#8220;application&#8221; thoughts and ideas for value adding to the iOS mobile application &#8220;Make Your Own Charts&#8221;.<\/p>\n<p>With that in mind we are adding a &#8220;less interactive&#8221; version of our Google Chart <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/histogram' title='Google Histogram Chart'>Histogram Chart<\/a> that concentrates on what a &#8220;Tallyer&#8221; (ie. one who keeps tally) might do.  We get the Histogram Chart interface web application to a point waiting for the one series of keyboard entries, perhaps entered by memorizing keys and pressing them without looking, concentrating on a vehicle type count perhaps.  So the user finalizes their &#8220;tally capture&#8221; phase by clicking a Javascript <a target=_blank title='Javascript prompt window information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_prompt.asp'>prompt<\/a> window&#8217;s OK button, resulting in a Histogram of findings.<\/p>\n<p>To get this functionality to work we needed changes as per &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/php_database.php_GETME\" title=\"php_database.php\">php_database.php<\/a> (not changed) &#8230; and then to interface to the &#8220;Make Your Own Charts&#8221; iOS iPad mobile application &#8230;<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/HistogramChart\/histogram_chart.php-----GETME\" title=\"histogram_chart.php\">histogram_chart.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/HistogramChart\/histogram_chart.php-----GETME\" title=\"histogram_chart.php\">this way<\/a>)<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/pie_chart.php--------GETME\" title=\"pie_chart.php\">pie_chart.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/pie_chart.php--------GETME\" title=\"pie_chart.php\">this way<\/a>)<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/butsel.php---GETME\" title=\"butsel.php\">butsel.php<\/a> (not changed)<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/justmenuWebView.html----GETME\" title=\"justmenuWebView.html\">justmenuWebView.html<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/justmenuWebView.html----GETME\" title=\"justmenuWebView.html\">this way<\/a>)<\/li>\n<\/ul>\n<hr>\n<p id='prdat'>Previous relevant <a target=_blank title='PHP Require Database Application Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-application-tutorial\/'>PHP Require Database Application Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/pie_chart.php?justmenu=justmenu\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Require Database Application Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/applying_php_database.jpg\" title=\"PHP Require Database Application Tutorial\" \/><\/a><p class=\"wp-caption-text\">PHP Require Database Application Tutorial<\/p><\/div>\n<p>This &#8220;PHP Require Database&#8221; concept of yesterday, with <a title='PHP Require Database Primer Tutorial' href='#prdpt'>PHP Require Database Primer Tutorial<\/a>, does have its uses, or &#8220;application&#8221;.<\/p>\n<p>Before we reveal what today&#8217;s &#8220;application&#8221; is, you need to see where it sits in the &#8220;permanency stakes&#8221; &#8230;<\/p>\n<ul>\n<li>beats a local Javascript var<font size=1>iable<\/font> in a local Javascript function<\/li>\n<li>beats a global Javascript var<font size=1>iable<\/font> for the life of a client webpage<\/li>\n<li>beats HTTP Cookie client storage<\/li>\n<li>beats $_SESSION[] PHP interwebpage permanency<\/li>\n<li>beats $_GET[] and $_POST[] PHP interwebpage permanency<\/li>\n<li>beats HTML5 LocalStorage<\/li>\n<li>beats Indexeddb&#8217;s ObjectStore<\/li>\n<li>our &#8220;PHP Require Database&#8221; concept probably sits here &#8230; not as permanent feeling as &#8230;<\/li>\n<li>web server flat files<\/li>\n<li>web server databases<\/li>\n<li>remote server databases<\/li>\n<\/ul>\n<p> &#8230; and we don&#8217;t see it as robust and flexible as those last few, really in this early stage having awkward delimitation rules, and in all practicality not really designed for lots of data in multiple database type fields.<\/p>\n<p>With that &#8220;flagging&#8221; feeling talent, as intimated above, today we use that &#8220;PHP Require Database&#8221; talent to &#8220;flag&#8221; when we are using an iOS (via Xcode) UIWebView housed webpage, where a call to start the mobile app is used to flag this scenario, and register that event with our &#8220;PHP Require Database&#8221;.  So, today, we use this &#8220;flagging&#8221; mechanism to &#8220;value add&#8221; to the menus of the &#8220;Make Your Own Chart&#8221; mobile application, today, as a start adding a &#8220;Pie Chart Fractions Game&#8221; to try to help teach fractions via that tried and trusted &#8220;pie cut up&#8221; approach.<\/p>\n<p>There were small changes to, mainly PHP, required by yesterday&#8217;s &#8220;child&#8221; &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/php_database.php_GETME\" title=\"php_database.php\">php_database.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/php_database.php-GETME\" title=\"php_database.php\">this way<\/a>) &#8230; and then to interface to the &#8220;Make Your Own Charts&#8221; iOS iPad mobile application &#8230;<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/pie_chart.php-------GETME\" title=\"pie_chart.php\">pie_chart.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/pie_chart.php-------GETME\" title=\"pie_chart.php\">this way<\/a>)<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/butsel.php---GETME\" title=\"butsel.php\">butsel.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/butsel.php---GETME\" title=\"butsel.php\">this way<\/a>)<\/li>\n<li><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/justmenuWebView.html---GETME\" title=\"justmenuWebView.html\">justmenuWebView.html<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/justmenuWebView.html---GETME\" title=\"justmenuWebView.html\">this way<\/a>)<\/li>\n<\/ul>\n<hr>\n<p id='prdpt'>Previous relevant <a target=_blank title='PHP Require Database Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-primer-tutorial\/'>PHP Require Database Primer Tutorial<\/a> is shown below.<\/p>\n<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,'_blank');  }  \">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<hr>\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='#d30914' onclick='var dv=document.getElementById(\"d30914\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mobile\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d30914' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d30926' onclick='var dv=document.getElementById(\"d30926\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/application\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d30926' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;PHP Require Database&#8221; concept of yesterday, with PHP Require Database Application Tutorial, opens the way for more Google Chart &#8220;application&#8221; thoughts and ideas for value adding to the iOS mobile application &#8220;Make Your Own Charts&#8221;. With that in mind &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-require-database-histogram-tallying-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":[96,1835,299,2242,519,565,626,630,795,797,932,997,2241,2096,1319],"class_list":["post-30926","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-application","tag-arguments","tag-database-2","tag-flag","tag-google-charts","tag-histogram","tag-ios","tag-ipad","tag-mobile","tag-mobile-application","tag-php","tag-programming","tag-require","tag-tally","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30926"}],"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=30926"}],"version-history":[{"count":2,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30926\/revisions"}],"predecessor-version":[{"id":30928,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/30926\/revisions\/30928"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=30926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=30926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=30926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}