MySQL function
#1

Quote:

[16:39:19] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[16:39:19] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[16:39:19] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[16:39:19] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')

Код:
public OnServerInfoLoad()
{
	serverInfo[taxi_darbo_fondas] = cache_get_field_content_int(0, "taxi_darbo_fondas", manomysql);
	serverInfo[mediku_darbo_fondas] = cache_get_field_content_int(0, "mediku_darbo_fondas", manomysql);
	serverInfo[policijos_darbo_fondas] = cache_get_field_content_int(0, "policijos_darbo_fondas", manomysql);
	serverInfo[mafijos_darbo_fondas] = cache_get_field_content_int(0, "mafijos_darbo_fondas", manomysql);
}
Problem is what I dont have playerid and name. This is global server information. What function
instead cache_get_field_content_int i can use?
Reply
#2

There are no rows. Use cache_num_rows first to make sure there are rows returned and then use the cache functions.
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
There are no rows. Use cache_num_rows first to make sure there are rows returned and then use the cache functions.
Something like this?

Код:
    new num_rows, num_fields;
    cache_get_data(num_rows, num_fields, manomysql);
    if(num_rows == 1)
Or this?

Quote:

new num_fields,num_rows;
cache_get_data(num_rows,num_fields,manomysql);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
//code
}

Reply
#4

If someone will have this error do this:

create
Quote:

new num_fields,num_rows;

Then
Quote:

cache_get_data(num_rows,num_fields,manomysql);

Quote:

if(!num_rows)return 1; // return if there isn't um rows

Then loop num_rows
Quote:

for(new i=0; i<num_rows; i++)

And in function use "i"
Quote:

cache_get_field_content_int(i, "info", mysql)



Thanks, problem solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)