Note that there are some explanatory texts on larger screens.

plurals
  1. POIE9 not clearing cache in between posts
    primarykey
    data
    text
    <p>I have a page that does the following:</p> <ol> <li>Click button to submit form</li> <li>Page posts to itself, and an SQL query is executed to update a field in the DB.</li> <li>The code then checks if there were any affected rows from the query execution and it is echoed. I expect it to echo Affected rows "1"</li> </ol> <p>In Firefox, Safari, and Chrome, this operation works every time without fail. In IE9 though, it works the first time, maybe 2 times or even 3, and then it does something weird - <strong>It echoes Affected rows "0"</strong> - <strong>even though the query executed just fine (the DB was updated).</strong></p> <p>I believe this is a <strong>cache problem</strong> of some sort, because when i clear the browser cache in IE before step 1 (submitting the form) it works every time as desired.</p> <p>Ive tried using this code:</p> <pre><code>header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1. header('Pragma: no-cache'); // HTTP 1.0. header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past </code></pre> <p>And this in the <code>&lt;head&gt;</code> tag:</p> <pre><code>&lt;meta http-equiv="Cache-Control" content="no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0" /&gt; &lt;meta http-equiv="Pragma" content="no-cache" /&gt; &lt;meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT" /&gt; </code></pre> <p>What is going on? How can i stop IE from playing up like this?</p> <p><strong>Update:</strong></p> <p>There seems to be some sort of inconsistency with PHP PDO's rowCount() (used to get affected rows)... In my case, i can't imagine how, but the inconsistency is linked to browser cache. Instead of using rowCount() after executing my query, i perform a SELECT to determine whether the field was updated with the new val. This seems to be working consistently.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload