title: how to force refresh of included php when database is updated
body: <p>I have a php page and in the middle of the page there is a second php page included, similar to below:</p>
  
  <pre><code>&lt;?php
  main content page
  &lt;?php include 'db-info.php';?&gt;
  more content
  ?&gt;
  </code></pre>
  
  <p>db-info.php displays a table with information from a database. When the database is updated, I would like the main page to show the updated results. If I have the db-info.php page as a stand-alone page I can make it refresh, but I don't know how to make the db-info.php refresh when it is included in the main content php page.  </p>
  
  <p>I would prefer not to constantly scan for changes to the database to trigger the refresh because the database is only updated when a button is clicked. Any ideas for how to link the button click or the database update to make the db-info.php page refresh?</p>
  
  <p>===== edit below ====</p>
  
  <p>Thanks Kaleb and Steven I appreciate your advice.  Even though the user clicks a button on the same page where the database info is displayed, the button is created like with document write syntax (this editor won't let me put the actual button code in)
  the button click triggers a function on a separate javascript file. Kaleb, I can re-write the way that the database information is displayed on the main php page but the main php page does not know that the database has been updated, unless I constantly check the database.  The problem is how to trigger the refresh on the main page when the button is clicked or the database is updated. I don't know how to capture that event or whatever to do whatever is needed.  The db-info.php page updates when the button in clicked and the database is updated.  The db-info.php page is updated but the main content php page still continues to display the same (outdated) db-info.php page that loaded when the main php page was originally loaded.</p>
  
  <p>================= update =====================</p>
  
  <p>I moved the button so that it is on the main content php page. The button triggers the javascript to update the database. Now, since the button is on the same page that has </p>
  
  <pre><code>&lt;?php include 'db-info.php';?&gt;
  </code></pre>
  
  <p>I should be able to do two things with the onclick, run the javascript and somehow onload and re-load the db-info.php page???  maybe?</p>
  
  <p>============ update =====================
  I will re-write the main content php page to build the database info table right into the main page.  I will still need a way to refresh that data separately from the entire main page content.</p>
  
  <p>============= please mark this question as answered ===========</p>
  
  <p>I apologize for the lack of clarity in my original question. Also, at first didn't understand the answers that were given but now I realize that they were pointing me in the right direction. Thanks again for the help.
  I plan to re-write the main content page to display the database info in the innerHTML of a div per the example here:</p>
  
  <pre><code>http://www.w3schools.com/php/php_ajax_database.asp
  </code></pre>
  
  <p>the db info will be displayed in this div</p>
  
  <pre><code>&lt;div id="dbInfoHere"&gt;Database info will be listed here&lt;/div&gt;
  </code></pre>
  
  <p>using this ajax to get the updated info from the database</p>
  
  <pre><code>document.getElementById("dbInfoHere").innerHTML = xmlhttp.responseText;
  xmlhttp.open("GET","save-rankings.php?q="+str,true);
  </code></pre>
  
  <p>in the example, the javascript is called with a select onchange event I can call the javascript from a button onclick event</p>