error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
The error I get:
PHP код:
error 035: argument type mismatch (argument 1)
The spoken function (I put "// Error line" after the line that shows the errors):
PHP код:
GetStats(playerid)
{
new string[128],
pName[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "SELECT * FROM users WHERE username = '%s'", pName);
mysql_query(string);
mysql_store_result();
while(mysql_fetch_row(string))
{
mysql_fetch_int("admin", gPlayerInfo[playerid][pAdmin]); // Error line
}
mysql_free_result();
return 1;
}
NOTE: Also look at post number #6 before you comment, I provided an important update.
Re: error 035: argument type mismatch (argument 1) -
iZN - 05.09.2013
The native is.
pawn Код:
mysql_fetch_int(connectionHandle);
This line should be blank, mysql_fetch_int(); ?
Re: error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
Then how would I get the admin variable and set the gPlayerInfo properly?
Re: error 035: argument type mismatch (argument 1) -
iZN - 05.09.2013
Which plugin are you using?
Re: error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
BlueG's MySQL plugin.
Re: error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
Alright guys, so I found another way to do this, and I tested it several times and it works, BUT I somewhat think that for some reason the way I found that works is inefficient and requires too much data saving, strings, etc..
So even though what I have now works, I'd like to get more comments, maybe there's a way to optimize the function.
My current function:
PHP код:
GetStats(playerid)
{
new string[128],
pName[MAX_PLAYER_NAME+1],
savingstring[20];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "SELECT * FROM users WHERE username = '%s'", pName);
mysql_query(string);
mysql_store_result();
while(mysql_fetch_row_format(string))
{
mysql_fetch_field_row(savingstring, "admin"); gPlayerInfo[playerid][pAdmin] = strval(savingstring);
}
mysql_free_result();
return 1;
}
Re: error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
Well?
Re: error 035: argument type mismatch (argument 1) -
dusk - 05.09.2013
Why is there a while loop? You're just going to over write the value of gPlayerInfo[playerid][pAdmin]....
You could just use "if"...
Not like one player will have more than one line for them, right?
Re: error 035: argument type mismatch (argument 1) -
Tomer!.$ - 05.09.2013
Quote:
Originally Posted by dusk
Not like one player will have more than one line for them, right?
|
Quote:
Originally Posted by playbox12
Why are you selecting everything just to take the admin row?
|
Did I ever say I'm not going to make more rows?
This is just a script I started from scratch a few days ago.. and since I just started learning MySQL today I figured I'll start with pAdmin only, and then add more as needed.
Re: error 035: argument type mismatch (argument 1) -
dusk - 05.09.2013
Quote:
Originally Posted by Tomer!.$
Did I ever say I'm not going to make more rows?
This is just a script I started from scratch a few days ago.. and since I just started learning MySQL today I figured I'll start with pAdmin only, and then add more as needed.
|
In this case, there's not really a way to optimize it more... But if you want to make it faster, use a newer version of the MySQL plugin.