MySQL problem -
alanhutch - 10.08.2014
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+!
Re: MySQL problem -
Kaperstone - 10.08.2014
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();
Re: MySQL problem -
alanhutch - 10.08.2014
Oh c'mon I have saw a answer and I was fucking happy... HELPP
Re: MySQL problem -
Kaperstone - 10.08.2014
Sorry, I just misunderstood the situation so I had to delete it quickly.
anyway, edited
Re: MySQL problem -
alanhutch - 10.08.2014
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.
Re: MySQL problem -
Kaperstone - 10.08.2014
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 ?
Re: MySQL problem -
alanhutch - 10.08.2014
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...
Re: MySQL problem -
Kaperstone - 10.08.2014
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.
Re: MySQL problem -
alanhutch - 10.08.2014
Re: MySQL problem -
alanhutch - 10.08.2014
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??