} else { // Display the number of contacts returned. echo '<p>' . count($contacts) . ' contacts were found. <a href="executesql-form.php">Click here</a> to search again.</p>'; // Display the results in a table. echo '<table class="gridtable">'; echo '<tr>'; echo '<th>Last Name</th>'; echo '<th>First Name</th>'; echo '<th>City</th>'; echo '<th>State</th>'; echo '<th>Zip Code</th>'; echo '</tr>'; // Loop over the results... foreach ($contacts as $row) { // Convert the row into an associative array. (Makes it easier to use the results.) $columns = fmGetRow($row, 'Last_Name, First_Name, City, State, Zip_Code'); // Display the row. echo '<tr>'; echo '<td>' . $columns['Last_Name'] . '</td>'; echo '<td>' . $columns['First_Name'] . '</td>'; echo '<td>' . $columns['City'] . '</td>'; echo '<td>' . $columns['State'] . '</td>'; echo '<td>' . $columns['Zip_Code'] . '</td>'; echo '</tr>' . "\n"; } echo '</table>'; } // Grab the contents of the output buffer. $ui_body_content = ob_get_contents(); // End output buffering, and erase the contents. ob_end_clean();
echo '<h1>Caching</h1>'; echo '<p>The data used in the table below was <b>not</b> pulled from the cache, and that is why it took so long for the page to load. '; echo 'In fact, <b>it took ' . $page_elapsed_time . ' seconds</b> just to obtain the data from the database server.'; echo '</p>'; echo '<p>'; echo 'In this example, an ExecuteSQL call was made with this SELECT statement: SELECT State, COUNT(*) FROM Contacts GROUP BY State ORDER BY State. (The demo database includes over 25,000 sample contact records.)'; echo '</p>'; echo '<p>To see how much faster the page loads when the cache is used, '; echo '<a href="cache-handler-with-cache.php?uuid=' . $uuid . '&elapsed=' . $page_elapsed_time . '">click here</a>.</p>'; echo '<table class="gridtable">'; echo '<tr>'; echo '<th>State</th>'; echo '<th># of Contacts</th>'; echo '</tr>'; // Loop over the results... foreach ($state_counts as $row) { // Convert the row into an associative array. (Makes it easier to use the results.) $columns = fmGetRow($row, 'State, Count'); // Display the row. echo '<tr>'; echo '<td>' . $columns['State'] . '</td>'; echo '<td>' . $columns['Count'] . '</td>'; echo '</tr>' . "\n"; } echo '</table>'; // Grab the contents of the output buffer. $ui_body_content = ob_get_contents(); // End output buffering, and erase the contents. ob_end_clean(); // Display the page, using the template. require_once dirname(__FILE__) . '/ui-template.php';