error 035: argument type mismatch (argument 1)
#1

The error I get:
PHP код:
error 035argument 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(playeridpNamesizeof(pName));
    
format(stringsizeof(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.
Reply
#2

The native is.
pawn Код:
mysql_fetch_int(connectionHandle);
This line should be blank, mysql_fetch_int(); ?
Reply
#3

Then how would I get the admin variable and set the gPlayerInfo properly?
Reply
#4

Which plugin are you using?
Reply
#5

BlueG's MySQL plugin.
Reply
#6

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(playeridpNamesizeof(pName));
    
format(stringsizeof(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;

Reply
#7

Well?
Reply
#8

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?
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)