Is this the most efficient way...?
#1

I have this piece of code:

pawn Код:
stock DoesEmailAddressExist(const emailaddress[])
{
    new szQuery[300], iReturnVal;
    format(szQuery, sizeof(szQuery), "SELECT `Email Address` FROM `Accounts` WHERE `Email Address` = '%s'", emailaddress);
    mysql_query(szQuery);
   
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        mysql_free_result();
        iReturnVal = 1;
    }
    else if(mysql_num_rows() == 0)
    {
        mysql_free_result();
        iReturnVal = 0;
    }
    return iReturnVal;
}
When players register on my server, their email address is stored. When new players register, I don't want them using the same email address. Therefore, this function is there to check if the email address is already saved in the DB. Now, my question is; Is the query used in this function the most efficient way to determine if the address exists, or is there an actual syntax for this?
Reply


Messages In This Thread
Is this the most efficient way...? - by Scenario - 18.12.2011, 02:39
Re: Is this the most efficient way...? - by [HiC]TheKiller - 18.12.2011, 02:45
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 02:47
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 02:54
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 02:59
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 03:01
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 03:04
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 03:06
Re: Is this the most efficient way...? - by Lorenc_ - 18.12.2011, 03:06
Re: Is this the most efficient way...? - by jamesbond007 - 18.12.2011, 03:18

Forum Jump:


Users browsing this thread: 1 Guest(s)