Two MySQL functions
#1

Well the two functions are 'mysql_store_result();' and 'mysql_free_result();'

I've heard many people saying that if no result was found, then it doesn't make sense to use 'mysql_free_result'.
Here's an example:

pawn Код:
for(new i = 1; i<MAX; i++)
        {
            format(String,sizeof(String),"SELECT `ID` FROM table WHERE `ID` = %d LIMIT 1",i);
            mysql_query(String);
            mysql_store_result();
            if(mysql_num_rows() == 0)
            {
                mysql_free_result();
                continue;
            }
            if(mysql_num_rows() != 0)
            {
                //do something
                mysql_free_result();
            }
        }
I want to know if it's correct to use 'mysql_free_result();' within 'if(mysql_num_rows() == 0);'
Reply


Messages In This Thread
Two MySQL functions - by Tee - 08.12.2011, 06:31
Re: Two MySQL functions - by xMichaelx - 08.12.2011, 06:33

Forum Jump:


Users browsing this thread: 1 Guest(s)