ok i figured out that the problem was with the product ID, its the productID:session thats how it was formatted so i edited the script to look like this:
PHP Code:
global $db;
$productArray = explode(":", $productID);
$code = 'No serial required for this product. If you do need a serial and did not recieve one please contact our staff.';
$dbres = $db->Execute("SELECT codeID, code FROM zen_codes WHERE viewed = 0 AND itemID = '" . $productArray[0] . "' LIMIT 1");
$i = 0;
while($dbres->RecordCount() == 1 && $i < 1)
{
$code = $dbres->fields['code'];
$db->Execute("UPDATE zen_codes SET viewed = 1 WHERE codeID = " . $dbres->fields['codeID']);
$i++;
}
return $code;
now that should work because its pulling the number from the array but when i go to check out (the 3rd step) it just keeps loading, no error message or anything, like its on an infinite loop...
but the i should stop it from looping right?