0

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;
    }

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Matthew N.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.