Raised This Month: $ Target: $400
 0% 

Solved [HELP] SQLite queries


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-03-2021 , 00:24   [HELP] SQLite queries
Reply With Quote #1

Good morning, I have an unsolved problem when making a query with SQLite, in the DB Browser for SQLite program the query returns normally with all the information, but when trying to perform the query in the game I get the following error:

Code:
Error: near "(": syntax error
The querie



PHP Code:
SELECT ROW_NUMBER() OVER (ORDER BY 1.0 kills deaths DESCPoskillsdeathsauth FROM tablename WHERE enabled AND kills AND deaths AND kills 100
PHP Code:

#define SQL_QUERY_CATCH_UPDATED_RANK    "SELECT ROW_NUMBER() OVER (ORDER BY 1.0 * kills / deaths DESC) Pos, kills, deaths, auth FROM %s WHERE enabled = 1 AND kills > 0 AND deaths > 0 AND kills > 100;"

public UpdatedRank(id)
{
        new 
szQuery[180]
        
formatex
        
(
                
szQuery,
                
charsmax(szQuery),
                
SQL_QUERY_CATCH_UPDATED_RANK,
                
SQL_TABLE
        
)

        new 
szData[2]
        
szData[0] = QUERY_UPDATE_RANK
        szData
[1] = id

        SQL_ThreadQuery
(g_hTuple,"SQL_HandleGlobal",szQuery,szData,sizeof(szData))
        return 
PLUGIN_HANDLED
}

public 
SQL_HandleGlobal(iState,Handle:hResult,szError[],iError,szData[],iSize)
{
        if(
iState == TQUERY_SUCCESS)
        {
                switch(
szData[0])
                {
                        case 
QUERY_UPDATE_RANK:
                        {
                                if(
is_user_connected(szData[1]))
                                {
                                        if(
SQL_NumRows(hResult))
                                        {
                                                new 
szSteamid[MAX_AUTHID_LENGTH]
                                                new 
iPos
                                                
while(SQL_MoreResults(hResult))
                                                {
                                                        
iPos SQL_ReadResult(hResult0)
                                                        
SQL_ReadResult(hResult3szSteamidcharsmax(szSteamid))

                                                        if(
equal(szSteamiduserData[szData[1]][szAuth]))
                                                        {
                                                                
userData[szData[1]][Rank] = iPos
                                                        
}

                                                        
SQL_NextRow(hResult)
                                                }
                                        }
                                }
                        }
                }
        }
        else
        {
                
log_amx("Error: %s"szError)
        }

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 05-04-2021 at 00:58.
iceeedr is offline
Send a message via Skype™ to iceeedr
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:30.


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