MySQL problem
#1

Hi all.

I wanted to know why, with this function, nothing happens.
pawn Код:
mysql_fetch_field_row(PlayerInfo[playerid][pNomePersonaggio1], "nomepersonaggio1");
mysql_fetch_field_row(PlayerInfo[playerid][pNomePersonaggio2], "nomepersonaggio2");
mysql_fetch_field_row(PlayerInfo[playerid][pNomePersonaggio3], "nomepersonaggio3");
This is on OnPlayerConnect, and it should write in the .ini file under pNomePersonaggio1-2-3 the names you have inserted in the registration.
In PHPMyAdmin, nomepersonaggio1-2-3 saves correctly when I register.

Can you help me? Thanks! I'll give you a REP+!
Reply
#2

EDIT:

Make sure you store your result with mysql_store_result and that you're fetching within a while loop

Or maybe try the sscanf way ?
pawn Код:
new str[128];
mysql_query(query);
    mysql_store_result();
    if(mysql_fetch_row_format(str)) {
        sscanf(str,"s[25]s[25]s[25]",PlayerInfo[playerid][pNomePersonaggio1],PlayerInfo[playerid][pNomePersonaggio2],PlayerInfo[playerid][pNomePersonaggio3]);
    }
    mysql_free_result();
Reply
#3

Oh c'mon I have saw a answer and I was fucking happy... HELPP
Reply
#4

Sorry, I just misunderstood the situation so I had to delete it quickly.
anyway, edited
Reply
#5

Yes, i store the data...
But I saw this in the Mysql_log
Код:
[22:22:30] CMySQLHandler::Query(SELECT * FROM users WHERE username = 'McGuire') - Successfully executed.
[22:22:30] >> mysql_store_result( Connection handle: 1 )
[22:22:30] CMySQLHandler::StoreResult() - Result was stored.
[22:22:30] >> mysql_fetch_field_row( Connection handle: 1 )
[22:22:30] CMySQLHandler::FetchField("nomepersonaggio1") - 
[22:22:30] >> mysql_fetch_field_row( Connection handle: 1 )
[22:22:30] CMySQLHandler::FetchField("nomepersonaggio2") - 
[22:22:30] >> mysql_fetch_field_row( Connection handle: 1 )
[22:22:30] CMySQLHandler::FetchField("nomepersonaggio3") -
I'm trying with the SSCANF way.
Reply
#6

Well, what you're fetching is a string, so you don't have to convert it into integar and the debug shows 0 errors.
Maybe use sscanf method instead ?
Reply
#7

Worked, but in a weird way.

When I go to select my account it appears like:
Код:
Christian_McGuire||McGuire
So the first name is right, but the second wtf...
Reply
#8

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
Worked, but in a weird way.

When I go to select my account it appears like:
Код:
Christian_McGuire||McGuire
So the first name is right, but the second wtf...
should have a p<|> (delimiter) before the strings in the sscanf(second parameter) to remove the |
The second is empty probably because there was something wrong in the query.
Reply
#9

Reply
#10

Quote:
Originally Posted by xkirill
Посмотреть сообщение
should have a p<|> (delimiter) before the strings in the sscanf(second parameter) to remove the |
The second is empty probably because there was something wrong in the query.
No, the second is right, i haven't inserted nothing.

So, (I'm not good with sscanf) how can I resolve this??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)