0

I want to define php function which will check if a value 1 is contained in specific column of ones and zeros in specific database table.

Is this the right way:

function insert_notifications_active_unactive($a)
{
    global $config,$conn;
    $UID = intval($a['USERID']);
    if($UID > 0)
    {
        $query = "select scriptolution_unread from fiverrscript_dotcom_notity where USERID='".mysql_real_escape_string($UID)."' order by NID desc limit 50"; 
        $results = $conn->execute($query);
        $readunread = $results->getrows();
            if (in_array("1", $readunread)) {$r = "1";}
            else {$r = "0";}
    }
    return $r;
}

I double checked it and think it is right, but obviously not, because it is returning "0" value every time.

0 Answers0