Raised This Month: $ Target: $400
 0% 

Error with MySql_Init


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 01-14-2011 , 11:00   Error with MySql_Init
Reply With Quote #1

Quote:
L 01/14/2011 - 17:58:24: [AMXX] Plugin says: Incorrect table definition; there can be only one auto column and it must be defined as a key
L 01/14/2011 - 17:58:24: [AMXX] Displaying debug trace (plugin "xx.amxx")
L 01/14/2011 - 17:58:24: [AMXX] Run time error 1: forced exit
L 01/14/2011 - 17:58:24: [AMXX] [0] xx.sma::MySql_Init (line 807)
MySql_Init:


PHP Code:
public MySql_Init()
{
    if(
get_pcvar_num(cvar_plugin) == 0)
        return 
PLUGIN_CONTINUE;
        
    
g_SqlTuple SQL_MakeDbTuple(Host,User,Pass,Db);
   
    new 
ErrorCode,Handle:SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error));
    
    if(
SqlConnection == Empty_Handle)
    
set_fail_state(g_Error);
       
    new 
Handle:Queries;
    
Queries SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS aa (id INT(11) NOT NULL AUTO_INCREMENT, steam varchar(32), lak int(12) NOT NULL default '0', auto INT(1) NOT NULL default '0', auto_lak INT(2) NOT NULL, access INT(1) NOT NULL default '0', welcome INT(1) NOT NULL default '0', welcome_msg varchar(256) NOT NULL)");

    if(!
SQL_Execute(Queries))
    {
        
SQL_QueryError(Queries,g_Error,charsmax(g_Error));
        
set_fail_state(g_Error);
    }
    
    
SQL_FreeHandle(Queries);
    
SQL_FreeHandle(SqlConnection);
    
    return 
PLUGIN_HANDLED;

reinert is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 01-14-2011 , 16:25   Re: Error with MySql_Init
Reply With Quote #2

try this:
PHP Code:
"CREATE TABLE IF NOT EXISTS aa (id INT(11) NOT NULL AUTO_INCREMENT UNIQUE KEY, steam varchar(32), lak int(12) NOT NULL default '0', auto  INT(1) NOT NULL default '0', auto_lak INT(2) NOT NULL, access INT(1) NOT  NULL default '0', welcome INT(1) NOT NULL default '0', welcome_msg  varchar(256) NOT NULL, PRIMARY KEY ( steam ));" 
__________________
Impossible is Nothing
Sylwester 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 02:14.


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