MySQL issue.
#1

Hii'.
Firstly, I asking you if it's a good way to do that :
PHP код:
    ...
    
mysql_pquery(MySQL"SELECT * FROM Tag""OnTagCount""");    // count number of tag saved
    
return 1;
}
PUBLIC:
OnTagCount()
{
    new 
rows;
    
cache_get_row_count(rows);
    for(new 
i=1<= rowsi++)
    {
        
mysql_pquery(MySQL"SELECT * FROM Tag WHERE `SQLIB` = '%i'""OnTagLoading""i"i); // load each of them
    
}
    
printf("- Chargement terminй. %i tag chargй."TagNumber);
}
PUBLIC:
OnTagLoading(tagid)
{
    
cache_get_value_name_int(0"ID"p_Tag[tagid][tID]);
    
cache_get_value_name_int(0"SQLIB"p_Tag[tagid][tSQLIB]);
    
cache_get_value(0"Owner"p_Tag[tagid][tOwner]);
... 
If not, please tell me how I should do that.
Secondly, I've these errors:
Код:
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_float: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
[16:40:21] [plugins/mysql] cache_get_value_name_int: invalid row index '0' (number of rows: '0')
Reply
#2

You already have the entire result set at your disposal in OnTagCount so there is absolutely NO need to send any further queries at that point. Everything in OnTagLoading can be placed inside the loop in OnTagCount. Replace row 0 with row i and tagid with i. Also rows start at 0.
Reply
#3

Why not just:
Код:
    ...
    mysql_pquery(MySQL, "SELECT * FROM Tag", "OnTagCount", "");    // count number of tag saved
    return 1;
}

PUBLIC:OnTagCount()
{
    new rows, x;
    cache_get_row_count(rows);
    for(new i; i < rows; i++) // loop to fetch all rows
    {
        x = i + 1; // x is to be used as p_Tag index, since your code tell that it's from 1. If it's from 0, just use i as index and remove x variable.
        cache_get_value_name_int(i, "ID", p_Tag[x][tID]);
        cache_get_value_name_int(i, "SQLIB", p_Tag[x][tSQLIB]);
        cache_get_value(i, "Owner", p_Tag[x][tOwner]);
    }
    printf("- Chargement terminй. %i tag chargй.", TagNumber);
}
Reply
#4

Lol, I'm so stupid.
Thanks you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)