i have an interesting problem where queries are being executed, but the changes are not reflected in the database.
<p>
i have a multi select that is used for re-ordering content items in a cms application. after moving the content items around in a multi select using javascript, the user submits the form.
<p>
the following javascript executes on submit to grab the multi select array:
<p>
<pre>
function selectAllSubmit(formElement) {
for (i=0; i < document.fm[formElement].options.length; i++) {
document.fm[formElement].options.selected = true;
document.fm.submit();
}
}
</pre>
<p>
then, the template loops through the form array, updating the sequence of the items in the database.
<p>
<pre>
process the select list and update content_element
for ($i = 1; $i <= sizeof($elementArray); $i++) {
$iMinusOne = $i -1;
$query = "update content_element set sequence=$i where contentElementID = $elementArray[$iMinusOne]";
$dbSequenceUpdate = mysql_query($query);
print("$query<br>mysql_affected_rows: ".mysql_affected_rows()."<br>");
}
</pre>
<p>
the print statements you see are for my own sanity as i debug, and they tell me that the correct update statements are being executed. <p>
however, when i go directly to the database and check the data, on seemingly random occasions, the item that i moved in the multi select did not get the sequence number it should of.
<p>
a call to phpinfo() confirms that the form array is making it to the processing template as it should.
<p>
thanks in advance,<br>
ed