babelfish
08-14-2008, 11:18 AM
:confused:Hi all,
im having some reliability issues with the following script called via ajax.
basically it should query the table, and bring a list back of ponumber(s) - the idea is then to give the user the option to select one of the used numbers or to use the newly generated number ($newponumber).
the problem is that there seems to be some form of caching issue somewhere. if the script works the first time it rarely works the 2nd time. it seems to fail to see any newly created ponumbers.
any ideas? if i load the php page itself it works all the time... but when called via ajax seems to be unreliable... which doesnt make sense to me.
im using the easywamp framework so its hosted on my test machine
$theid = $_REQUEST['theid'];
$query = "SELECT DISTINCT ponumber FROM poitems ORDER BY ponumber DESC";
$result = mysql_query($query);
$ponum = "";
$poflag = false;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($poflag == false) {
$newponumber = $row['ponumber'] + 1;
$poflag = true;
}
$ponum = $ponum . "<a href='javascript:;' onclick=\"setPONum('ponumber$theid','{$row['ponumber']}','$theid')\">{$row['ponumber']}</a><br />\n";
}
mysql_free_result($result);
echo "<div class='dropdown' style='width:116px;'>\n";
echo "<a href='javascript:;' onclick=\"setPONum('ponumber$theid','$newponumber','$theid')\">$newponumber</a> <strong>(New number)</strong><br />\n";
echo "$ponum<br />\n";
echo "<a href=\"javascript:;\" onclick=\"hidediv('ponumselector$theid')\">Close [x]</a>";
echo "</div>";
im having some reliability issues with the following script called via ajax.
basically it should query the table, and bring a list back of ponumber(s) - the idea is then to give the user the option to select one of the used numbers or to use the newly generated number ($newponumber).
the problem is that there seems to be some form of caching issue somewhere. if the script works the first time it rarely works the 2nd time. it seems to fail to see any newly created ponumbers.
any ideas? if i load the php page itself it works all the time... but when called via ajax seems to be unreliable... which doesnt make sense to me.
im using the easywamp framework so its hosted on my test machine
$theid = $_REQUEST['theid'];
$query = "SELECT DISTINCT ponumber FROM poitems ORDER BY ponumber DESC";
$result = mysql_query($query);
$ponum = "";
$poflag = false;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($poflag == false) {
$newponumber = $row['ponumber'] + 1;
$poflag = true;
}
$ponum = $ponum . "<a href='javascript:;' onclick=\"setPONum('ponumber$theid','{$row['ponumber']}','$theid')\">{$row['ponumber']}</a><br />\n";
}
mysql_free_result($result);
echo "<div class='dropdown' style='width:116px;'>\n";
echo "<a href='javascript:;' onclick=\"setPONum('ponumber$theid','$newponumber','$theid')\">$newponumber</a> <strong>(New number)</strong><br />\n";
echo "$ponum<br />\n";
echo "<a href=\"javascript:;\" onclick=\"hidediv('ponumselector$theid')\">Close [x]</a>";
echo "</div>";