13.05.2018, 21:00
Quote:
Even if old, I believe my MySQL include is easier to be understood and used: https://sampforum.blast.hk/showthread.php?tid=609990
|
Even if old, I believe my MySQL include is easier to be understood and used: https://sampforum.blast.hk/showthread.php?tid=609990
|
Even if old, I believe my MySQL include is easier to be understood and used: https://sampforum.blast.hk/showthread.php?tid=609990
|
Hey max, rep+ for this i love it but i was wonder if you can go to the other level and make a tutorial about using some of the functions that aren't the basic. The samp community would greatly appreciate.
|
The following code is not working:
PHP код:
In the Mysql log: PHP код:
But no data in chat! |
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);
Update include and try this.
https://github.com/ThreeKingz/easy-m...easy-mysql.inc PHP код:
|
...\pawno\include\easy-mysql.inc(191) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(254) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(307) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(370) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(402) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(463) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(516) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(553) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(606) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(638) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(2097) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(2393) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(2407) : warning 213: tag mismatch
...\pawno\include\easy-mysql.inc(2462) : warning 213: tag mismatch
if(mysql_errno(SQL::ReadCache[i]) != 0)
Thanks for this update!
But I get this error: PHP код:
PHP код:
|
SQL::DeleteRowEx2
SQL::GetStringEntryEx2
SQL::t_GetStringEntryEx2
SQL::GetIntEntryEx2
SQL::GetFloatEntryEx2
SQL::SetIntEntryEx2
SQL::SetStringEntry2
SQL::SetStringEntryEx2
SQL::SetFloatEntryEx2
SQL::RowExistsEx2
SQL::DeleteRow3
PHP код:
|
LoadPlayerBankCards(playerid)
{
new p_name_inside_f[MAX_PLAYER_NAME], Query[164], DBResult:GetPlayerBankCards, Dialog_String[226];
GetPlayerName(playerid, p_name_inside_f, sizeof(p_name_inside_f));
format(Query, sizeof(Query), "SELECT * FROM `bank-cards` WHERE `username` = '%s'", DB_Escape(p_name_inside_f));
format(Dialog_String, sizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");
GetPlayerBankCards = db_query(Users, Query);
if(db_num_rows(GetPlayerBankCards))
{
for(new i; i<db_num_rows(GetPlayerBankCards); i++)
{
new card_name[64], card_cash, card_id, cards_info[64];
db_get_field_assoc(GetPlayerBankCards, "cardname", card_name, sizeof(card_name));
card_cash = db_get_field_assoc_int(GetPlayerBankCards, "cash");
card_id = db_get_field_assoc_int(GetPlayerBankCards, "id");
p_bank_card[playerid][p_bank_card_loaded[playerid]][cash] = card_cash;
p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id] = card_id;
strcat(p_bank_card[playerid][p_bank_card_loaded[playerid]][name], card_name);
p_bank_card_loaded[playerid]++;
format(cards_info, sizeof(cards_info), "\t%s\t%d\n", card_name, card_cash);
strcat(Dialog_String, cards_info);
db_next_row(GetPlayerBankCards);
}
}
else
{
SendClientMessage(playerid, -1, "Tqven Ar Gaqvt Sabanko Baratebi!");
}
db_free_result(GetPlayerBankCards);
ShowPlayerDialog(playerid, 81, DIALOG_STYLE_TABLIST_HEADERS, "Sabanko Baratebi", Dialog_String, "Sworia", "Bugia");
return 1;
}
PHP код:
|
LoadPlayerBankCards(playerid)
{
new p_name_inside_f[MAX_PLAYER_NAME], Dialog_String[226];
GetPlayerName(playerid, p_name_inside_f, sizeof(p_name_inside_f));
format(Dialog_String, sizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");
if(SQL::RowExistsEx("bank-cards", "username", p_name_inside_f))
{
new handle = SQL::OpenEx(SQL::MREAD, "bank-cards", "username", p_name_inside_f);
SQL::ReadRetrievedRows(handle, i)
{
SQL::ReadString(handle, "cardname", p_bank_card[playerid][p_bank_card_loaded[playerid]][name], 64, i);
SQL::ReadInt(handle, "cash", p_bank_card[playerid][p_bank_card_loaded[playerid]][cash], i);
SQL::ReadInt(handle, "id", p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id], i);
format(cards_info, sizeof(cards_info), "\t%s\t%d\n", p_bank_card[playerid][p_bank_card_loaded[playerid]][name], p_bank_card[playerid][p_bank_card_loaded[playerid]][cash]);
strcat(Dialog_String, cards_info);
}
SQL::Close(handle);
}
else
{
SendClientMessage(playerid, -1, "Tqven Ar Gaqvt Sabanko Baratebi!");
}
ShowPlayerDialog(playerid, 81, DIALOG_STYLE_TABLIST_HEADERS, "Sabanko Baratebi", Dialog_String, "Sworia", "Bugia");
return 1;
}
Version 3.7 released.
PHP Code:
|
SQL::DeleteRowEx2
SQL::GetStringEntryEx2
SQL::t_GetStringEntryEx2
SQL::GetIntEntryEx2
SQL::GetFloatEntryEx2
SQL::SetIntEntryEx2
SQL::SetStringEntry2
SQL::SetStringEntryEx2
SQL::SetFloatEntryEx2
SQL::RowExistsEx2
SQL::DeleteRow3
stock SQL::RowExistsEx2(const table[], const column_where[] = "", const row_identifier[], const column_where2[] = "", const row_identifier2[] = "", row_identifier3 = -1, MySQL:connectionHandle = MYSQL_DEFAULT_HANDLE)
{
new query[SQL_FORM_LENGTH], query2[SQL_FORM_LENGTH], Cache:result, rows;
format(query, sizeof(query), "SELECT * FROM `%s` WHERE `%s`='%e'", table, column_where, row_identifier); // HERE.
if(!isnull(column_where2) && !isnull(row_identifier2) && row_identifier3 == -1)
{
format(query2, sizeof(query2), " AND `%s`='%e'", column_where2, row_identifier2); // HERE AS WELL.
strcat(query, query2);
}
if(!isnull(column_where2) && row_identifier3 != -1 && isnull(row_identifier2))
{
format(query2, sizeof(query2), " AND `%s`='%d'", column_where2, row_identifier3);
strcat(query, query2);
}
strcat(query, " ");
result = mysql_query(connectionHandle, query);
if(mysql_errno() != 0)
{
return SQL_Warning("Query could not be completed due to error: %s", query);
}
cache_get_row_count(rows);
cache_delete(result);
if(rows > 0)
{
return rows;
}
return 0;
}