AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to Get value from Database (https://forums.alliedmods.net/showthread.php?t=309628)

HITLER 08-01-2018 19:32

How to Get value from Database
 
Hello,
First sorry for my bad English

i want code to get Value player_xp from that Table in the photo

https://www19.zippyshare.com/scaled/xqYMg1SO/file.html

i wasted 1 full day in search and trying but it didn't work. :)
i know someone can do that in 1 min.
i need an example

pleas help me :3

LenHard 08-01-2018 19:51

Re: How to Get value from Database
 
PHP Code:

char[] sQuery = new char[200];        
FormatEx(sQuery200"SELECT `player_xp` FROM `%s` WHERE player_id = \"%s\""TABLEPlayer_Id);
gD_Database.Query(SQL_PlayerXPsQuery); // gD_Database is the Database Handle

public void SQL_PlayerXP(Database hDatabaseDBResultSet hResults, const char[] sError)
{
    if (
hResults == null
        
ThrowError(sError);
    else if (
hResults.RowCount != 1)
        return;
        
    
hResults.FetchRow();
    
hResults.FetchInt(0); // The value




All times are GMT -4. The time now is 00:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.