CMySQLResult::GetRowDataByName() - invalid row index ('0')
#1

PHP код:
        mysql_format(SQLgQuerysizeof(gQuery), "SELECT * FROM `friends` WHERE `AddBy` = '%d'"PlayerInfo[playerid][pSQLID]);
        
results mysql_query(SQLgQuery);
        for(new 
icache_get_row_count (); != j; ++i)
        {
            
cache_get_field_content(i"friendName"gString);
            new 
userID GetPlayerID(gString);
            if(
userID != INVALID_PLAYER_IDonf ++;
        }
        
cache_delete(results); 
or
PHP код:
mysql_format(SQLgQuerysizeof(gQuery), "SELECT * FROM `friends` WHERE `AddBy` = '%d' AND `friendID` = '%d'"PlayerInfo[i][pSQLID], PlayerInfo[playerid][pSQLID]);
                
results mysql_query(SQLgQuery);
                
cache_get_field_content(0"AddBy"gString); 
Anyone help me please?
Reply
#2

If there is no result to return, you will try to retrieve from an invalid row. Check if cache_get_row_count is not 0 before getting the data (I'm referring to the second).
Reply
#3

Can you give me an example @Konstantinos?
Reply
#4

If it returns more than 1 row, then use a loop like in the first one.
If it returns only 1 row (which in this case you better add "LIMIT 1" at the end of the query), then:
pawn Код:
if (cache_get_row_count(SQL))
{
    cache_get_field_content(0, "AddBy", gString);
}
Reply
#5

Doesn't work.
Reply
#6

Try this
PHP код:
        mysql_format(SQLgQuerysizeof(gQuery), "SELECT * FROM `friends` WHERE `AddBy` = '%d'"PlayerInfo[playerid][pSQLID]); 
        
results mysql_query(SQLgQuery); 
        for(new 
icache_get_row_count (); j; ++i
        { 
            
cache_get_field_content(i"friendName"gString); 
            new 
userID GetPlayerID(gString); 
            if(
userID != INVALID_PLAYER_IDonf ++; 
        } 
        
cache_delete(results); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)