Raised This Month: $ Target: $400
 0% 

[AMXX]Run time error 10(native "SQL_PrepareQuery")


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MASKED
Junior Member
Join Date: Jan 2016
Old 01-04-2016 , 11:17   [AMXX]Run time error 10(native "SQL_PrepareQuery")
Reply With Quote #1

Code:
L 01/04/2016 - 10:43:34: Start of error session.
L 01/04/2016 - 10:43:34: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20160104.log")
L 01/04/2016 - 10:43:34: [MySQL] Invalid database handle: 0
L 01/04/2016 - 10:43:34: [AMXX] Run time error 10 (plugin "ncodmodmysql.amxx") (native "SQL_PrepareQuery") - debug
PHP Code:
public Load(id)
    {
            new 
Name[32];
    
get_user_name(idName31);
    new 
error[128], errno;
    new 
Handle:info SQL_MakeStdTuple();
    new 
Handle:sql SQL_Connect(infoerrnoerror127);
 
    new 
Handle:query SQL_PrepareQuery(sql"SELECT * FROM `oles_szam` WHERE `username` = '%s'"Name);
 
 
    if (!
SQL_Execute(query))
        
server_print("[NiCE skin] Hiba tortent a lekeres soran. #1");
    else if (!
SQL_NumResults(query)) {
        
Kills[id] = 0;
        
Rang[id] = 0;
        
m4a1_oles[id] = 0;
        
ak47_oles[id] = 0;
        
awp_oles[id] = 0;
        
kes_oles[id] = 0;
    } else {        
        new 
qcol_oles SQL_FieldNameToNum(query"oles");
        new 
qcol_rang SQL_FieldNameToNum(query"rang");
        new 
qcol_m4a1 SQL_FieldNameToNum(query"m4a1");
        new 
qcol_ak47 SQL_FieldNameToNum(query"ak47");
        new 
qcol_awp SQL_FieldNameToNum(query"awp")    ;    
        new 
qcol_kes SQL_FieldNameToNum(query"kes");
 
        
Kills[id]= SQL_ReadResult(query,    qcol_oles);
        
Rang[id]= SQL_ReadResult(query,    qcol_rang);
        
m4a1_oles[id]= SQL_ReadResult(query,    qcol_m4a1);
        
ak47_oles[id]= SQL_ReadResult(query,    qcol_ak47);
        
awp_oles[id] = SQL_ReadResult(query,    qcol_awp);
        
kes_oles[id] = SQL_ReadResult(query,    qcol_kes);
 
        
SQL_FreeHandle(query);
        
SQL_FreeHandle(sql);
        
SQL_FreeHandle(info);
    }
 
    return 
PLUGIN_CONTINUE;
    }
    public 
Save(id)
    {
    new 
Name[32];
    
get_user_name(idName31);
    new 
error[128], errno;
    new 
Handle:info SQL_MakeStdTuple();
    new 
Handle:sql SQL_Connect(infoerrnoerror127);
 
     new 
Handle:query SQL_PrepareQuery(sql"INSERT INTO `oles_szam`  (`username`, `oles`, `rang`, `m4a1`, `ak47`, `awp`, `kes`) VALUES  ('%s',%d,%d,%d,%d,%d,%d) ON DUPLICATE KEY UPDATE `oles`=VALUES(`oles`),  `rang`=VALUES(`rang`), `m4a1`=VALUES(`m4a1`), `ak47`=VALUES(`ak47`),  `awp`=VALUES(`awp`), `kes`=VALUES(`kes`)",  sqlesc(Name),Kills[id],Rang[id],m4a1_oles[id],ak47_oles[id],awp_oles[id],kes_oles[id]);
 
 
    if (!
SQL_Execute(query))
        
server_print("[NiCE skin] Hiba tortent a lekeres soran. #2");
    return 
PLUGIN_CONTINUE;
    }
    
#define SECURE_NAME_LEN 31 * 2 + 1
    
sqlesc(const name[])
    {
    new 
secureName[SECURE_NAME_LEN];
    
copy(secureNamecharsmax(secureName), name);
    
replace_all(secureNamecharsmax(secureName), "\", "\\");
    replace_all(secureName, charsmax(secureName), "
`", "\`");
    replace_all(secureName, charsmax(secureName), "'", "\'");
 
    return secureName;
    } 
Hello, guys!
can you tell me that, why is my server shutting down about every 16th hour?
I get this error from time to time, and i dont know what the problem is...
MASKED is offline
 



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 09:28.


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