Raised This Month: $51 Target: $400
 12% 

[HELP] MySQL Simple save problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 04-27-2016 , 03:15   [HELP] MySQL Simple save problem
Reply With Quote #1

http://pastebin.com/MuXMnHmj

As you see plugin_end function is quoted because it gives me error : [MySQL] Invalid handle: 0

The variable: escapes just does not saves.. I haven't got any errors from the plugin.


P.S. I put the code in pastebin because when I try to post the thread with the code - cloudflare of the forum does not allows me (maybe because of the sql symbols idk)..

Last edited by KaLoIaN; 04-27-2016 at 04:02.
KaLoIaN is offline
Old 04-27-2016, 04:14
tousif
This message has been deleted by tousif.
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 04-27-2016 , 05:51   Re: [HELP] MySQL Simple save problem
Reply With Quote #2

Doesn't
PHP Code:
"UPDATE `zmescape` SET `escapes` = '%i' WHERE `escapes`.`name` = '%s' 
has to be
PHP Code:
"UPDATE `zmescape` SET `escapes` = '%i' WHERE `zmescape`.`name` = '%s' 
You don't need to specify the column's table since you are updating it.

PHP Code:
"UPDATE `zmescape` SET `escapes` = '%i' WHERE `name` = '%s' 

Last edited by SpeeDeeR; 04-27-2016 at 05:58.
SpeeDeeR is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 04-27-2016 , 08:19   Re: [HELP] MySQL Simple save problem
Reply With Quote #3

Here is how I made the update line:

Code:
format(szTemp,charsmax(szTemp),"UPDATE `zmescape` SET `escapes` = '%i' WHERE `zmescape`.`name` = '%s';",escapes[id], szName)
But it's still not working. It just does not saves.
KaLoIaN is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 04-28-2016 , 16:45   Re: [HELP] MySQL Simple save problem
Reply With Quote #4

Somebody?
KaLoIaN is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-29-2016 , 08:37   Re: [HELP] MySQL Simple save problem
Reply With Quote #5

PHP Code:
format(szTemp,charsmax(szTemp),"UPDATE `zmescape` SET `escapes` = '%i' WHERE `zmescape`.`name` = '%s';",escapes[id], szName
This is redundant

>>

PHP Code:
format(szTemp,charsmax(szTemp),"UPDATE `zmescape` SET `escapes` = '%i' WHERE `name` = '%s';",escapes[id], szName
You don't need to specify the table if you're manipulating only one.
__________________
gabuch2 is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 04-30-2016 , 08:49   Re: [HELP] MySQL Simple save problem
Reply With Quote #6

Quote:
Originally Posted by Shattered Heart Lynx View Post
PHP Code:
format(szTemp,charsmax(szTemp),"UPDATE `zmescape` SET `escapes` = '%i' WHERE `zmescape`.`name` = '%s';",escapes[id], szName
This is redundant

>>

PHP Code:
format(szTemp,charsmax(szTemp),"UPDATE `zmescape` SET `escapes` = '%i' WHERE `name` = '%s';",escapes[id], szName
You don't need to specify the table if you're manipulating only one.
Again it does not save anything .....
KaLoIaN is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 05-01-2016 , 12:51   Re: [HELP] MySQL Simple save problem
Reply With Quote #7

Is it so damn difficult lol? No one has made an correct answer...
KaLoIaN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-01-2016 , 14:45   Re: [HELP] MySQL Simple save problem
Reply With Quote #8

This doesn't appear to have anything to do with his SQL query.

Are you setting g_SqlTuple to 0 somewhere else in your code? Are you getting this error in any other places when you try to use g_SqlTuple?
__________________

Last edited by Bugsy; 05-01-2016 at 14:46.
Bugsy is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 05-01-2016 , 15:06   Re: [HELP] MySQL Simple save problem
Reply With Quote #9

g_SqlTuple is not set to 0 nowhere. And yes I am getting it everytime I am using this tutorial:

click me

but it seems to be not well written or I do somethin' bad..

The main problem is that it does not saves.
KaLoIaN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-01-2016 , 15:45   Re: [HELP] MySQL Simple save problem
Reply With Quote #10

See if this works for you:
PHP Code:

#include <amxmodx>
#include <sqlx>

new Handle:g_SQLTuple g_szQueryCache2000 ];

new const 
SQL_CreateTable[] = "QUERY TO CREATE TABLE WHICH WAS BLOCKED BY SERVER";

public 
plugin_init() 
{
    
SQL_SetAffinity"sqlite" );
    
g_SQLTuple SQL_MakeDbTuple"" "" "" "MyDatabaseFile" );
    
    new 
Handle:SqlConnection ErrorCode;
    
SqlConnection SQL_Connectg_SQLTuple ErrorCode g_szQueryCache charsmaxg_szQueryCache ) );
    
    if( 
SqlConnection == Empty_Handle )
        
set_fail_stateg_szQueryCache );
    
    
RunQuerySqlConnection SQL_CreateTable );
}

public 
plugin_end() 
{
    
SQL_FreeHandleg_SQLTuple );
}

public 
RunQueryHandle:SQLConnection , const szQuery[] )
{
    new 
Handle:Query SQL_PrepareQuerySQLConnection szQuery );
    
    if( !
SQL_ExecuteQuery ) )
    {
        
SQL_QueryErrorQuery g_szQueryCache 100 );
        
set_fail_stateg_szQueryCache );
    }

__________________
Bugsy is offline
Reply



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 03:05.


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