bigmoxy
asked on
Need Help with block of code
Greetings All,
I'm puzzled. When I add the code block below to my PHP script my web page goes blank. I've eyeballed it several times and don't see anything wrong. Perhaps there is a kind soul who could review the code and tell me if there are any errors.
I've narrowed my problem down to the do while loop. For some reason my page doesn't like do... while (some condition) loop.
TIA,
Tim
I'm puzzled. When I add the code block below to my PHP script my web page goes blank. I've eyeballed it several times and don't see anything wrong. Perhaps there is a kind soul who could review the code and tell me if there are any errors.
I've narrowed my problem down to the do while loop. For some reason my page doesn't like do... while (some condition) loop.
TIA,
Tim
$stock_num = $_SESSION['stocknumber'];
if ($stock_num ^= '') {
$check = "SELECT * FROM recycle_it_in WHERE stock_num='$stock_num'";
$checkResult = mysql_query($check);
$checkRows = mysql_num_rows($checkResult);
if ((isset($checkRows)) && ($checkRows == 0))
{
$_SESSION['ri_stocknumber'] = "RI" . rand(000000,999999);
$is_unique = 'no';
do {
$ri_stock_num = $_SESSION['ri_stocknumber'];
$check2 = "SELECT * FROM recycle_it_in WHERE ri_stock_num='$ri_stock_num'";
$checkResult2 = mysql_query($check2);
$checkRows2 = mysql_num_rows($checkResult2);
if ((isset($checkRows2)) && ($checkRows2 == 0))
{
is_unique = 'yes';
}
else {
$_SESSION['ri_stocknumber'] = "RI" . rand(000000,999999);
}
} while (is_unique ^= 'yes');
}
else {
$row = mysql_fetch_array($checkResult);
$_SESSION['ri_stocknumber'] = $row['ri_stock_num'];
}
}// closing if ($stock_num ^= '') {
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And:
} while (is_unique != 'yes');
should be:
} while ($is_unique != 'yes');
} while (is_unique != 'yes');
should be:
} while ($is_unique != 'yes');
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Yes ..you miss '$' in two places with is_unique.
Yes ..you miss '$' in two places with is_unique.
use '!=' instead of '^='
I dont see any error than this.
Regards.