Quote:
Originally Posted by JR_Junior
The following code is not working:
PHP код:
new string[128], names[24],money;
new handle = SQL::OpenEx(SQL::MREAD, "Accounts", "", -1, 10, -1, "Money");
SQL::ReadRetrievedRows(handle, i)
{
SQL::ReadString(handle, "AccountName", names, 24, i);
SQL::ReadInt(handle, "Money", money, i);
format(string, sizeof(string), "Name %s | Money: %d", names,money);
SendClientMessage(playerid, -1, string);
}
SQL::Close(handle);
Accounts in DB: 7
In the Mysql log:
PHP код:
[13:42:36] [DEBUG] mysql_query(1, "SELECT * FROM `Accounts` WHERE `Money`='' ORDER BY `Money` DESC LIMIT 10 ", 1)
[13:42:36] [DEBUG] CHandle::Execute(this=0x4f8c170, type=3, query=0x6705fd0)
[13:42:36] [DEBUG] CConnection::Execute(query=0x6705fd0, this=0x674f80, connection=0x4fa5968)
[13:42:36] [DEBUG] CQuery::Execute(this=0x6705fd0, connection=0x4fa5968)
[13:42:36] [INFO] query "SELECT * FROM `Accounts` WHERE `Money`='' ORDER BY `Money` DESC LIMIT 10 " successfully executed within 0.616 milliseconds
[13:42:36] [DEBUG] CResultSet::Create(connection=0x4fa5968, query_str='SELECT * FROM `Accounts` WHERE `Money`='' ORDER BY `Money` DESC LIMIT 10 ')
[13:42:36] [DEBUG] created new resultset '0x6710788'
[13:42:36] [DEBUG] fetched MySQL result '0x66f8990'
[13:42:36] [DEBUG] allocated 0 bytes for PAWN result
[13:42:36] [DEBUG] CHandle::Execute - return value: true
[13:42:36] [DEBUG] mysql_query: return value: '1'
[13:42:36] [DEBUG] cache_is_valid(1)
[13:42:36] [DEBUG] cache_is_valid: return value: 'true'
[13:42:36] [DEBUG] cache_get_row_count(0x05FFF1E0)
[13:42:36] [DEBUG] cache_get_row_count: return value: '1'
[13:42:36] [DEBUG] cache_get_row_count(0x05FFF1D8)
[13:42:36] [DEBUG] cache_get_row_count: return value: '1'
[13:42:36] [DEBUG] cache_is_valid(1)
[13:42:36] [DEBUG] cache_is_valid: return value: 'true'
[13:42:36] [DEBUG] cache_delete(1)
[13:42:36] [DEBUG] cache_delete: return value: '1'
Tried too: new handle = SQL::Open(SQL::MREAD, "Accounts", "Money", -1, "", -1, "", -1, -1, "Money");
But no data in chat!
|
Update include and try this.
https://github.com/ThreeKingz/easy-m...easy-mysql.inc
PHP код:
new string[128], names[24],money;
new handle = SQL::OpenEx(SQL::MREAD, "Accounts", "", -1, 10, -1, "Money");
SQL::ReadRetrievedRows(handle, i)
{
SQL::ReadString(handle, "AccountName", names, 24, i);
SQL::ReadInt(handle, "Money", money, i);
format(string, sizeof(string), "Name %s | Money: %d", names,money);
SendClientMessage(playerid, -1, string);
}
SQL::Close(handle);