Raised This Month: $ Target: $400
 0% 

Error first time SQL


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 05-06-2013 , 13:43   Error first time SQL
Reply With Quote #1

This is my first time trying to understand MySQL

Im getting this error in the console and
it doesnt save or load.

Error:
Code:
[pointmod.amxx] Load Query failed. [1] near "AUTO_INCREMENT": syntax error
Code:
Code:
public plugin_precache() 
{ 
 MySQL_Tuple = SQL_MakeDbTuple(Host, User, Pass, Db) 
 SQL_ThreadQuery(MySQL_Tuple, "SQL_TrashHandler", "CREATE TABLE IF NOT EXISTS `Points_Shop`(`id` INT(1) NOT NULL AUTO_INCREMENT, `steamid` VARCHAR(32), `name` VARCHAR(32), `points` INT(1), `kills` INT(1), `killed` INT(1), `suicides` INT(1), `survives` INT(1), PRIMARY KEY(`id`))")
} 
public client_putinserver(id)
{
 MySQL_Load(id)
}
public client_disconnect(id)
{
 MySQL_Save(id)
}
public MySQL_Save(const id) {
 new szBugName[32], szName[32];
 get_user_name(id, szBugName, charsmax(szBugName))
 MakeStringSQLSafe(szBugName, szName, charsmax(szName))
 
 new szAuthid[32]
 get_user_authid(id, szAuthid, charsmax(szAuthid))
 for( new i ; i < MAX_SKINS ; i ++ ) 
 
 formatex(MySQL_Query, charsmax(MySQL_Query), "UPDATE `Points_Shop` SET `name` = '%s', `points` = '%i', `totalpoints` = '%i', `jumps` = '%i', `knife` = '%d', `player` = '%d', `bought` = '%i' WHERE `steamid`='%s'", szName, gKillerPoints[id], gTotalKillerPoints[id], vJump[id], knife_model[id], player_model[id], g_bBoughtSkin[id][i], szAuthid)
 SQL_ThreadQuery(MySQL_Tuple, "SQL_TrashHandler", MySQL_Query)
}
MakeStringSQLSafe(const input[], output[], len)
{
 copy(output, len, input);
 replace_all(output, len, "'", "*");
 replace_all(output, len, "^"", "*");
 replace_all(output, len, "`", "*");
}
public MySQL_Load(id) {
 new szAuthid[32]
 get_user_authid(id, szAuthid, charsmax(szAuthid))
 
 new Temp[1]
 Temp[0] = id
 
 formatex(MySQL_Query, charsmax(MySQL_Query), "SELECT * FROM `Points_Shop` WHERE `steamid` = '%s'", szAuthid)
 SQL_ThreadQuery(MySQL_Tuple, "Load_PlayerInfo", MySQL_Query, Temp, sizeof(Temp))
}
public Load_PlayerInfo(FailState, Handle:Query, Error[], Errcode, Data[], DataSize) {
 if(FailState == TQUERY_CONNECT_FAILED)
  log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error)
 else if(FailState == TQUERY_QUERY_FAILED)
  log_amx("Load Query failed. [%d] %s", Errcode, Error)
 
 new id = Data[0]
 
 new szName[32], szBugName[32], szAuthid[32]; 
 get_user_name(id, szBugName, charsmax(szBugName));
 MakeStringSQLSafe(szBugName, szName, sizeof(szName) - 1);
 
 get_user_authid(id, szAuthid, charsmax(szAuthid))
 
 formatex(MySQL_Query, charsmax(MySQL_Query), "INSERT INTO `Points_Shop` (`steamid`, `name`) VALUES ('%s', '%s')", szAuthid, szName)
 SQL_ThreadQuery(MySQL_Tuple, "SQL_TrashHandler", MySQL_Query)
}
public SQL_TrashHandler(FailState,Handle:Query,Error[],Errcode,Data[],DataSize) { 
 if(FailState == TQUERY_CONNECT_FAILED)
  log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error)
 else if(FailState == TQUERY_QUERY_FAILED)
  log_amx("Load Query failed. [%d] %s", Errcode, Error)
 
 SQL_FreeHandle(Query)
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
 



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 10:47.


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