I can’t find anything wrong with this… This should work right?
function ConfirmedNumber()
{
$rs = mysql_query("CALL ConfirmedNumber('" , $_SESSION['UserID'] . "',@Active)");
while ($row = mysql_fetch_assoc($rs))
{
if ($row['Active'] = 1)
{
return true;
}
}
return false;
}
Assuming the Stored procedure returns a single row with the value ‘1’ in it then I can call the function like this right?
if (ConfirmedNumber())
{
//do some stuff.
}
To expand on my comment:
if ($row['Active'] = 1)should beif ($row['Active'] == 1)to work correctly.If you want to avoid accidentally doing this in future, you could write your if statements like this:
This way, you can’t accidentally use
=as PHP will throw a Fatal Error. You can read more about Comparison Operators at PHP.netComment below with the full answer: