database mysql no load invalid datatype
#1

DEBUG MYSQL
PHP Code:
[02:01:55] [DEBUGmysql_connect host"localhost"user"root"database"database"password"****"port3306autoreconnecttruepool_size2
[02:01:55] [DEBUGCMySQLHandle::Create creating new connection..
[
02:01:55] [DEBUGCMySQLHandle::CMySQLHandle constructor called
[02:01:55] [DEBUGCMySQLHandle::Create connection created (id1)
[
02:01:55] [DEBUGCMySQLConnection::Connect establishing connection to database...
[
02:01:55] [DEBUGCMySQLConnection::Connect connection was successful
[02:01:55] [DEBUGCMySQLConnection::Connect auto-reconnect has been enabled
[02:01:55] [DEBUGmysql_errno connection1
[02:01:55] [DEBUGCMySQLConnection::Connect establishing connection to database...
[
02:01:55] [DEBUGCMySQLConnection::Connect establishing connection to database...
[
02:01:55] [DEBUGCMySQLConnection::Connect connection was successful
[02:01:55] [DEBUGCMySQLConnection::Connect connection was successful
[02:01:55] [DEBUGCMySQLConnection::Connect auto-reconnect has been enabled
[02:01:55] [DEBUGCMySQLConnection::Connect auto-reconnect has been enabled
[02:01:55] [DEBUGCMySQLConnection::Connect auto-reconnect has been enabled
[02:02:22] [DEBUGmysql_format connection1len128format"SELECT `Password`, `ID` FROM `users` WHERE `Name` = '%e' LIMIT 1"
[02:02:22] [DEBUGmysql_tquery connection1query"SELECT `Password`, `ID` FROM `users` WHERE `Name` = 'damar' LIMI"callback"OnAccountCheck"format"i"
[02:02:22] [DEBUGCMySQLQuery::Execute[OnAccountCheck] - starting query execution
[02:02:22] [DEBUGCMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 1.174 milliseconds
[02:02:22] [DEBUGCMySQLResult::CMySQLResult() - constructor called
[02:02:22] [DEBUGCalling callback "OnAccountCheck"..
[
02:02:22] [DEBUGcache_get_data connection1
[02:02:22] [DEBUGcache_get_field_content row0field_name"Password"connection1max_len129
[02:02:22] [DEBUGCMySQLResult::GetRowDataByName row'0'field"Password"data"FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2"
[02:02:22] [DEBUGcache_get_field_content_int row0field_name"ID"connection1
[02:02:22] [DEBUGCMySQLResult::GetRowDataByName row'0'field"ID"data"2"
[02:02:22] [DEBUGCMySQLResult::~CMySQLResult() - deconstructor called
[02:02:27] [DEBUGmysql_format connection1len214format"SELECT * FROM `users` WHERE `Name` = '%e'"
[02:02:27] [DEBUGmysql_tquery connection1query"SELECT * FROM `users` WHERE `Name` = ''"callback"OnAccountLoad"format"i"
[02:02:27] [DEBUGCMySQLQuery::Execute[OnAccountLoad] - starting query execution
[02:02:27] [DEBUGCMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 0.479 milliseconds
[02:02:27] [DEBUGCMySQLResult::CMySQLResult() - constructor called
[02:02:27] [DEBUGCalling callback "OnAccountLoad"..
[
02:02:27] [DEBUGcache_get_field_content_int row0field_name"ID"connection1
[02:02:27] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
02:02:27] [ERRORcache_get_field_content_int invalid datatype
[02:02:27] [DEBUGcache_get_field_content_int row0field_name"pEXP"connection1
[02:02:27] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
02:02:27] [ERRORcache_get_field_content_int invalid datatype
[02:02:27] [DEBUGcache_get_field_content_int row0field_name"pAdminLevel"connection1
[02:02:27] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
02:02:27] [ERRORcache_get_field_content_int invalid datatype
[02:02:27] [DEBUGcache_get_field_content_int row0field_name"Premium"connection1
[02:02:27] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
02:02:27] [ERRORcache_get_field_content_int invalid datatype
[02:02:27] [DEBUGCMySQLResult::~CMySQLResult() - deconstructor called
[02:02:57] [DEBUGmysql_format connection1len526format"UPDATE `users` SET `pEXP` = '%d', `Premium` = %d, `pAdminLevel` = %d WHERE `Name` = '%s'"
[02:02:57] [DEBUGmysql_tquery connection1query"UPDATE `users` SET `pEXP` = '10000', `Premium` = 0, `pAdminLevel"callback"(null)"format"(null)"
[02:02:57] [DEBUGCMySQLQuery::Execute[] - starting query execution
[02:02:57] [DEBUGCMySQLQuery::Execute[] - query was successfully executed within 55.29 milliseconds
[02:02:57] [DEBUGCMySQLQuery::Execute[] - no callback specifiedskipping result saving 
scipt AccountLoad
PHP Code:
forward OnAccountLoad(playerid);
public 
OnAccountLoad(playerid)
{
    
pInfo[playerid][ID] = cache_get_field_content_int(0"ID");
    
pInfo[playerid][pEXP] = cache_get_field_content_int(0"pEXP");
    
pInfo[playerid][pAdminLevel] = cache_get_field_content_int(0"pAdminLevel");
    
pInfo[playerid][Premium] = cache_get_field_content_int(0"Premium");
    
TogglePlayerSpectating(playeridfalse);
    
GivePlayerMoney(playeridpInfo[playerid][pEXP]);
    
SendClientMessage(playerid, -1"You have successfully logged in.");
    
SpawnPlayer(playerid);
    return 
1;

scipt save player
PHP Code:
stock SaveStats(playerid)
{
    new 
query[526];
    
mysql_format(mysqlquerysizeof(query), "UPDATE `users` SET `pEXP` = '%d', `Premium` = %d, `pAdminLevel` = %d WHERE `Name` = '%s'",
    
pInfo[playerid][pEXP], pInfo[playerid][Premium], pInfo[playerid][pAdminLevel], PlayerName(playerid));
    
mysql_tquery(mysqlquery);
    return 
1;

Reply
#2

Code:
"SELECT * FROM `users` WHERE `Name` = ''"
Name is empty. That also causes the invalid row as there are no records for that.
Re-look your code when selecting all the data and since you have loaded the ID along with password, use that in the WHERE clause instead of the name.
Reply
#3

PHP Code:
stock SaveStats(playerid)
{
    new 
query[2048];
    
format(querysizeof(query), "UPDATE `users` SET `pEXP` = '%d', `Premium` = %d, `pAdminLevel` = %d WHERE `Name` = ''",
    
pInfo[playerid][pEXP], pInfo[playerid][Premium], pInfo[playerid][pAdminLevel], PlayerName(playerid));
    
mysql_tquery(mysqlquery"","");
    return 
1;

so ?
Reply
#4

PHP Code:
[04:34:30] [DEBUGCalling callback "LoadAkun"..
[
04:34:30] [DEBUGcache_get_field_content_int row0field_name"ID"connection1
[04:34:30] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
04:34:30] [ERRORcache_get_field_content_int invalid datatype
[04:34:30] [DEBUGcache_get_field_content_int row0field_name"pEXP"connection1
[04:34:30] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
04:34:30] [ERRORcache_get_field_content_int invalid datatype
[04:34:30] [DEBUGcache_get_field_content_int row0field_name"pAdminLevel"connection1
[04:34:30] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
04:34:30] [ERRORcache_get_field_content_int invalid datatype
[04:34:30] [DEBUGcache_get_field_content_int row0field_name"Premium"connection1
[04:34:30] [ERRORCMySQLResult::GetRowDataByName() - invalid row index ('0')
[
04:34:30] [ERRORcache_get_field_content_int invalid datatype
[04:34:30] [DEBUGCMySQLResult::~CMySQLResult() - deconstructor called
[04:34:39] [DEBUGmysql_tquery connection1query"UPDATE `users` SET `pEXP` = '123124', `Premium` = 0, `pAdminLeve"callback"(null)"format"(null)"
[04:34:39] [DEBUGCMySQLQuery::Execute[] - starting query execution
[04:34:39] [DEBUGCMySQLQuery::Execute[] - query was successfully executed within 0.601 milliseconds
[04:34:39] [DEBUGCMySQLQuery::Execute[] - no callback specifiedskipping result saving 
Still not fix
Reply
#5

I pointed out what is wrong (what is written in mysql logs), not that it should be empty.. Change the above as it was and the problem is here:
pawn Code:
"SELECT * FROM `users` WHERE `Name` = '%e'"
When formatting, name is empty so you don't get the player's name. A better option is to use:
pawn Code:
..., "SELECT * FROM `users` WHERE `ID` = %i LIMIT 1", pInfo[playerid][ID]);
Reply
#6

PHP Code:
[04:46:35] [DEBUGCalling callback "LoadAkun"..
[
04:46:35] [DEBUGcache_get_field_content_int row0field_name"ID"connection1
[04:46:35] [DEBUGCMySQLResult::GetRowDataByName row'0'field"ID"data"3"
[04:46:35] [DEBUGcache_get_field_content_int row0field_name"pEXP"connection1
[04:46:35] [DEBUGCMySQLResult::GetRowDataByName row'0'field"pEXP"data"0"
[04:46:35] [DEBUGcache_get_field_content_int row0field_name"pAdminLevel"connection1
[04:46:35] [DEBUGCMySQLResult::GetRowDataByName row'0'field"pAdminLevel"data"10"
[04:46:35] [DEBUGcache_get_field_content_int row0field_name"Premium"connection1
[04:46:35] [DEBUGCMySQLResult::GetRowDataByName row'0'field"Premium"data"0"
[04:46:35] [DEBUGCMySQLResult::~CMySQLResult() - deconstructor called 
Thanks Konstatinopel i REP ++++ SOLVED OMG
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)