MYSQL: mysql_fetch_field_row issue.
#1

Sup.

I've been working with Y_INI for months now and I've decided I want to start learning MySQL.

I was looking at tutorials last night and decided I'll restart a blank gamemode just so I can test using MySQL.

Can anyone notice whats wrong here?

It works properly if I use sscanf but with this method, it doesn't seem to work.

pawn Код:
new query[600],loadstr[20],pName[MPN];
GetPlayerName(playerid,pName,MPN);
format(query,sizeof(query),"SELECT * FROM accounts WHERE Name = '%s'",pName);

mysql_query(query);
mysql_store_result();

while(mysql_fetch_row_format(query,"|"))
{
    //sscanf(query,"p<|>ds[24]s[129]",AccountInfo[playerid][Id],AccountInfo[playerid][Name],AccountInfo[playerid][Password]); <-- I decided to test it with sscanf and it worked properly.
    mysql_fetch_field_row(loadstr,"ID");  AccountInfo[playerid][Id] = strval(loadstr);
    //^ works properly aswell, I printed out the ID and it's correct.
        //The last debug print shows here.
    mysql_fetch_field_row(AccountInfo[playerid][Name],"Name"); //<-- Crashes here.
    mysql_fetch_field_row(AccountInfo[playerid][Password],"Password");
}

mysql_free_result();
Here's the MySQL debugging information gathered.
Код:
[16:53:19] >> mysql_query( Connection handle: 1 )
[16:53:19] CMySQLHandler::Query(SELECT * FROM accounts WHERE name = 'Alonso_Moreno') - Successfully executed.
[16:53:19] >> mysql_store_result( Connection handle: 1 )
[16:53:19] CMySQLHandler::StoreResult() - Result was stored.
[16:53:19] >> mysql_num_rows( Connection handle: 1 )
[16:53:19] CMySQLHandler::NumRows() - Returned 1 row(s)
[16:53:22] >> mysql_query( Connection handle: 1 )
[16:53:22] CMySQLHandler::Query(SELECT * FROM accounts WHERE Name = 'Alonso_Moreno' AND Password = '000848C01650C0BC877F49A29F45A1AF342A7521E7EEE3B4960DF61AA5739085FD8CF38C22AA4F63E48E289134C822D521CBF9E5B75AD1D96C1C43F8B474CC24') - Successfully executed.
[16:53:22] >> mysql_store_result( Connection handle: 1 )
[16:53:22] CMySQLHandler::StoreResult() - Result was stored.
[16:53:22] >> mysql_num_rows( Connection handle: 1 )
[16:53:22] CMySQLHandler::NumRows() - Returned 1 row(s)
[16:53:22] >> mysql_query( Connection handle: 1 )
[16:53:22] CMySQLHandler::Query(SELECT * FROM accounts WHERE Name = 'Alonso_Moreno') - Successfully executed.
[16:53:22] >> mysql_store_result( Connection handle: 1 )
[16:53:22] CMySQLHandler::StoreResult() - Result was stored.
[16:53:22] >> mysql_retrieve_row( Connection handle: 1 )
[16:53:22] >> mysql_fetch_field_row( Connection handle: 1 )
[16:53:22] CMySQLHandler::FetchField("ID") - 8
[16:53:22] >> mysql_fetch_field_row( Connection handle: 1 )
Reply


Messages In This Thread
MYSQL: mysql_fetch_field_row issue. - by EiresJason - 17.05.2014, 15:43
Re: MYSQL: mysql_fetch_field_row issue. - by Patrick - 17.05.2014, 15:58
Re: MYSQL: mysql_fetch_field_row issue. - by EiresJason - 17.05.2014, 16:05

Forum Jump:


Users browsing this thread: 1 Guest(s)