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
#2

Basically you are freeing you result, it should only be where a mysql_store_result is, read through [HiC]TheKiller's tut on "Create A MySQL System"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)