Please help me i having this problem,
Current is my code:

error at line "if(mysql_num_rows($result)!=0)"


function getNewID($init,$field,$table)
    {
        $num = rand(1,100000000);

        $act_id = $init.$num;

        $query = "SELECT $field FROM $table WHERE $field = '$act_id'";
        $result = mysql_db_query("ssimage_db", $query);

            if(mysql_num_rows($result)!=0)
        { $exist = true; }
        else{ $exist = false; }

        while($exist)
        {
            $num = rand(1,100000000);

            $act_id = "$init".$num;

            $query = "SELECT $field FROM $table WHERE $field = '$act_id'";
            $result = mysql_db_query("ssimage_db", $query);
            if(mysql_num_rows($result)!=0)
            {
                $exist = true;
            }
            else
            {
                $exist = false;
            }
        }
        return $act_id;
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.