{HELP} MySQL
#1

Hello, I have a problem. I'm putting my rescue gamemode for MySQL

error:

Код:
[15:56:50]  1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkil' at line 1      INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina` `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic` `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12` VALUES ('','','2','0','0','0','0','0','0','0','0','0','0','','','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5', '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','86','0','0','affw','0','0','0','0','0','','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0') 1
Pawn:
pawn Код:
new Str[2906], Nome[21];
            GetPlayerName(playerid,Nome,21);
            format(Str, 413, "INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina`,");
            format(Str, 810, " %s `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic`,", Str);
            format(Str, 1251, " %s `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12`)", Str);
            format(Str, 2226, " %s VALUES ('%s','%s','2','0','0','0','0','0','0','0','0','0','0','%i','%i','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','%f','0','%i','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5',", Str);
            format(Str, 2907, " %s '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','%i','0','0','%s','0','0','0','0','0','%s','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')", Str, Nome, password, PlayerInfo[playerid][pReg], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pSHealth], PlayerInfo[playerid][pPnumber], PlayerInfo[playerid][pTut], PlayerInfo[playerid][pMarriedTo],PlayerInfo[playerid][pLastLogin]);
            mysql_function_query(Connect, Str, false, #, #);
What can I do? Already recounted the characters of the string already analyzed several times over has something going unnoticed.

I will be very grateful if someone can help me. Thank you!
Reply
#2

I have no idea why you use # you're probably old school scripter , try this code, this could work (atleast try :P )

pawn Код:
mysql_function_query(Connect, Str, false, "", ""); //used "" instead of #
Or

You could simply INSERT the password, all rows will be assigned as null [b]Automatically

pawn Код:
new
    Str[256], Nome[24];
GetPlayerName(playerid,Nome, sizeof(Nome));
format(Str, sizeof(str), "INSERT INTO `contas` (`Nome`, `Key`) VALUES ('%s', '%s')", Nome, password);
mysql_function_query(Connect, Str, false, "", "");
EDIT: @Konstantinos never knew about that , atleast I learnt something new , cheers mate
Reply
#3

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
I have no idea why you use # you're probably old school scripter , try this code, this could work (atleast try :P )

pawn Код:
mysql_function_query(Connect, Str, false, "", ""); //used "" instead of #
# is used instead of ""

Example:
pawn Код:
print( #Example! );
is the same as:
pawn Код:
print( "Example!" );
I'm not sure about the problem either from a look I took so debug it please.

pawn Код:
// formats..
print( Str );
mysql_function_query(Connect, Str, false, #, #);
It will print the query to the console. Post it here or execute it to phpMyAdmin (it might say why).

EDIT: You are welcome, pds2k12!
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
# is used instead of ""
I'm not sure about the problem either from a look I took so debug it please.

pawn Код:
// formats..
print( Str );
mysql_function_query(Connect, Str, false, #, #);
It will print the query to the console. Post it here or execute it to phpMyAdmin (it might say why).
PRINT:
pawn Код:
[16:29:46]     INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina` `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic` `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12` VALUES ('','','2','0','0','0','0','0','0','0','0','0','0','','','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5', '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','86','0','0','aff','0','0','0','0','0','','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')
Is disorganized values ​​..

'aff' = password;
There are also blank fields

OMG o.O
Reply
#5

pawn Код:
"`Maconha`, `Cocaina` `Crack`, `Lider`"
There's a missing comma before `Crack`

In the format, the comma exists so you used 1 less character. Change the lenght to 414 and try again.

And for the last one (lenght) 2907, you need to change it to 2906 or change the size of Str to its declaration to 2907.

The size is very large, so remove few spaces as much as you can to reduce it a bit, starting off:
pawn Код:
" %s blabla.."
The first space is not needed at all and it takes extra characters.

About the blank, I'm not sure. You may pass as an arguments strings which are NULL.
Reply
#6

The syntax error is gone *-* I will thank you very much to everyone who helped me *-*

Konstantinos owe you one. Thank you very much!

I will now analyze what is causing it, I imagine it's something simple =)

Print
pawn Код:
[16:52:21]     INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina`, `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic`, `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12`) VALUES ('','','2','0','0','0','0','0','0','0','0','0','0','','','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5', '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','86','0','0','aff','0','0','0','0','0','','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')
Erro
pawn Код:
[16:52:21]  1136 Column count doesn't match value count at row 1      INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina`, `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic`, `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12`) VALUES ('','','2','0','0','0','0','0','0','0','0','0','0','','','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5', '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','86','0','0','aff','0','0','0','0','0','','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0') 1
Reply
#7

Use default values!
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
Use default values!
More even I ultilize default here and diminished enough, when I use the UPDATE, will have to change everything.
Correct?
Reply
#9

115 columns [From INSERT INTO `contas ( ... columns ... )]
116 values [FROM VALUES ( ... values ... )]

So you missed a field.

I also agree with Vince about default values.
Reply
#10

What are the positives and negatives using default values​​?

And in case the update, I would have to put all the values ​​is not?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)