SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/08/2016, 12:21 PM   #1
Sirop
Big Clucker
 
Sirop's Avatar
 
Join Date: Oct 2015
Posts: 91
Reputation: 2
Default error 001: expected token:

Hello and sorry for my english

HTML Code:
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(489 -- 617) : error 001: expected token: ",", but found ";"
HTML Code:
format(query, sizeof(query), "INSERT INTO `compte` (`Enregistrer` = '%d', `Vie` = '%d', `Gillet` = '%d', `Masque` = '%d', `MasqueID` = '%d', `Faction` = '%d', `Grade` = '%d', `Situation` = '%d'",
  
	format(query, sizeof(query), "%s, `Mort` = '%d', `TempsJail` = '%d', `Warn` = '%d', `Banned` = '%d'",
        query,
		/*pInfo[playerid][Mort],
		pInfo[playerid][JailTime],
		pInfo[playerid][Warn],
		pInfo[playerid][Baned]*/
	//);

	format(query, sizeof(query), "%s, `Maison` = '%d', `Commerce` = '%d', `FactionProprietaire` = '%d', `Vehicule1` = '%d', `Vehicule2` = '%d', `Vehicule3` = '%d'",
        query,
        /*pInfo[playerid][HouseOwner],
		pInfo[playerid][BizOwner],
		pInfo[playerid][FacOwner],
		pInfo[playerid][VehicleOwner],
		pInfo[playerid][VehicleOwner2],
		pInfo[playerid][VehicleOwner3]*/
	//);

	format(query, sizeof(query), "%s `Level` = '%d', `Experience` = '%d', `MaxExperience` = '%d', `Skin` = '%d', `Sexe` = '%d', `Cash` = '%d', `CashBanque` = '%d'",
        query,
		/*pInfo[playerid][Level],
		pInfo[playerid][Exp],
		pInfo[playerid][MaxExp],
		pInfo[playerid][Skin],
		pInfo[playerid][Gender],
		pInfo[playerid][HandMoney],
		pInfo[playerid][BankMoney]*/
	//);

	format(query, sizeof(query), "%s, `NumeroTel` = '%d', `Cheque` = '%d', `Temps` = '%d', `Amende` = '%d', `Facture` = '%d', `Emprunt` = '%d', `Lotto` = '%d', `Permis` = '%d', `PermisPoint` = '%d', `PortArme` = '%d'",
	query,
		/*pInfo[playerid][PhoneNumber],
		pInfo[playerid][PayeCheck],
		pInfo[playerid][PayeTime],
		pInfo[playerid][Amende],
		pInfo[playerid][Facture],
		pInfo[playerid][Emprunt],
		pInfo[playerid][Lotto],
		pInfo[playerid][Permis],
		pInfo[playerid][PermisPoint],
		pInfo[playerid][PortArme]*/

	//);

	format(query, sizeof(query), "%s `Montre` = '%d', `GPS` = '%d', `Canne` = '%s', `Telephone` = '%s', `Credits` = '%d', `Identite` = '%d', `GramDrogue1` = '%d', `GramDrogue2` = '%d'",
        query,
		/*pInfo[playerid][Montre],
		pInfo[playerid][Gps],
		pInfo[playerid][Canne],
		pInfo[playerid][Phone],
		pInfo[playerid][Credits],
		pInfo[playerid][CarteIden],
		pInfo[playerid][DrogueFab1],
		pInfo[playerid][DrogueFab2]*/
	//);
	/*
	for (new i = 0; i < 13; i ++) {
		format(query, sizeof(query), "%s, `Gun%d` = '%d', `Ammo%d` = '%d'", query, i + 1, pInfo[playerid][pGuns][i], i + 1, pInfo[playerid][pAmmo][i]);
	}
	*/
	format(query, sizeof(query), "%s, `GramDrogue3` = '%d', `Cocaine` = '%d', `Heroine` = '%d', `Ecstacy` = '%d', `Arme1` = '%d', `Minition1` = '%d', `Arme2` = '%d', `Minition2` = '%d', `Arme3` = '%d', `Minition3` = '%d', `Arme4` = '%d', `Minition4` = '%d', `Arme5` = '%d', `Minition5` = '%d', `Arme6` = '%d', `Minition6` = '%d', `Arme7` = '%d', `Minition7` = '%d')",
	    query,

	format(query, sizeof(query), "%s, VALUES('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
		query,
		pInfo[playerid][Registered],
		pInfo[playerid][Health],
		pInfo[playerid][Armour],
		pInfo[playerid][Mask],
		pInfo[playerid][MaskID],
		pInfo[playerid][SecteID],
		pInfo[playerid][Grade],
		pInfo[playerid][LastPos],
		pInfo[playerid][Mort],
		pInfo[playerid][JailTime],
		pInfo[playerid][Warn],
		pInfo[playerid][Baned],
		pInfo[playerid][HouseOwner],
		pInfo[playerid][BizOwner],
		pInfo[playerid][FacOwner],
		pInfo[playerid][VehicleOwner],
		pInfo[playerid][VehicleOwner2],
		pInfo[playerid][VehicleOwner3],
		pInfo[playerid][Level],
		pInfo[playerid][Exp],
		pInfo[playerid][MaxExp],
		pInfo[playerid][Skin],
		pInfo[playerid][Gender],
		pInfo[playerid][HandMoney],
		pInfo[playerid][BankMoney],
		pInfo[playerid][PhoneNumber],
		pInfo[playerid][PayeCheck],
		pInfo[playerid][PayeTime],
		pInfo[playerid][Amende],
		pInfo[playerid][Facture],
		pInfo[playerid][Emprunt],
		pInfo[playerid][Lotto],
		pInfo[playerid][Permis],
		pInfo[playerid][PermisPoint],
		pInfo[playerid][PortArme],
		pInfo[playerid][Montre],
		pInfo[playerid][Gps],
		pInfo[playerid][Canne],
		pInfo[playerid][Phone],
		pInfo[playerid][Credits],
		pInfo[playerid][CarteIden],
		pInfo[playerid][DrogueFab1],
		pInfo[playerid][DrogueFab2],
		pInfo[playerid][DrogueFab3],
		pInfo[playerid][Cocaine],
		pInfo[playerid][Heroine],
		pInfo[playerid][Ecstacy],
		pInfo[playerid][Weapon1],
		pInfo[playerid][Wep1Ammo],
		pInfo[playerid][Weapon2],
		pInfo[playerid][Wep2Ammo],
		pInfo[playerid][Weapon3],
		pInfo[playerid][Wep3Ammo],
		pInfo[playerid][Weapon4],
		pInfo[playerid][Wep4Ammo],
		pInfo[playerid][Weapon5],
		pInfo[playerid][Wep5Ammo],
		pInfo[playerid][Weapon6],
		pInfo[playerid][Wep6Ammo],
		pInfo[playerid][Weapon7],
		pInfo[playerid][Wep7Ammo]
    );
    mysql_tquery(g_iHandle, query, "Enregistrement", "dd", playerid, CREATION);
	mysql_tquery(g_iHandle, query);
Sirop is offline   Reply With Quote
Old 04/08/2016, 12:37 PM   #2
Fantje
Huge Clucker
 
Join Date: Dec 2014
Posts: 393
Reputation: 9
Default Re: error 001: expected token:

Somewhere you have used ";" but you need to use "," can't find where for now bc I'm in a hurry.
__________________
Fantje is offline   Reply With Quote
Old 04/08/2016, 12:40 PM   #3
Shinja
Gangsta
 
Shinja's Avatar
 
Join Date: Jan 2016
Posts: 972
Reputation: 107
Default Re: error 001: expected token:

I think you meant to use strcat, there are many errors here
Shinja is offline   Reply With Quote
Old 04/08/2016, 02:47 PM   #4
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 1,939
Reputation: 504
Default Re: error 001: expected token:

You are commenting the closing bracket and semicolon (");") in your code thats why you getting this error.
SyS is offline   Reply With Quote
Old 04/08/2016, 04:16 PM   #5
Sirop
Big Clucker
 
Sirop's Avatar
 
Join Date: Oct 2015
Posts: 91
Reputation: 2
Default Re: error 001: expected token:

Quote:
Originally Posted by Shinja View Post
I think you meant to use strcat, there are many errors here
Yes i meant To use strcat how To use Correctly strcat ?
Sirop is offline   Reply With Quote
Old 04/08/2016, 04:37 PM   #6
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: error 001: expected token:

First of all the syntax is incorrect. If you want to have them as "column = value", then you have to use SET after the table's name otherwise use the standard way "INSERT INTO table (fields..) VALUES (values..)" or if you set every single column, you can ignore the name of the fields; however, they must be in order.

The table's design is bad, read more here: http://forum.sa-mp.com/showthread.php?t=505081

Have default values when needed. I doubt all those variables hold a different value than the original set.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 04/08/2016, 05:32 PM   #7
Sirop
Big Clucker
 
Sirop's Avatar
 
Join Date: Oct 2015
Posts: 91
Reputation: 2
Default Re: error 001: expected token:

I have changed

HTML Code:
SQL_CreationCompte(playerid)
{
	if (!pInfo[playerid][pLogged])
		return 0;

	static
		        query[128];

	
	mysql_format(query,  sizeof(query), "INSERT INTO `compte` (`Enregistrer` = %d, \
    `Vie` = %d, \
    `Gillet` = %d, \
    `Masque` = %d, \
    `MasqueID` = %d, \
    `Faction` = '%e', \
    `Grade` = %d, \
    `Situation` = %d, \
    `Mort` = %d, \
    `TempsJail` = %d, \
    `Warn` = %d, \
    `Banned` = %d, \
    `Maison` = %d, \
    `Commerce` = %d, \
    `FactionProprietaire` = %d, \
    `Vehicule1` = %d, \
    `Vehicule2` = %d, \
    `Vehicule3` = %d, \
	`Level` = %d, \
    `Experience` = %d, \
    `MaxExperience` = %d, \
    `Skin` = %d, \
    `Sexe` = %d, \
    `Cash` = %d, \
    `CashBanque` = %d, \
    `NumeroTel` = %d, \
    `Cheque` = %d, \
    `Temps` = %d, \
    `Amende` = %d, \
    `Facture` = %d, \
    `Emprunt` = %d, \
    `Lotto` = %d, \
    `Permis` = %d, \
    `PermisPoint` = %d, \
    `PortArme` = %d, \
    `Montre` = %d, \
    `GPS` = %d, \
    `Canne` = %d, \
    `Telephone` = %d, \
    `Credits` = %d, \
    `Identite` = %d, \
    `GramDrogue1` = %d, \
    `GramDrogue2` = %d, \
    `GramDrogue3` = %d, \
    `Cocaine` = %d, \
    `Heroine` = %d, \
    `Ecstacy` = %d, \
    `Arme1` = %d, \
    `Minition1` = %d, \
    `Arme2` = %d, \
    `Minition2` = %d, \
    `Arme3` = %d, \
    `Minition3` = %d, \
    `Arme4` = %d, \
    `Minition4` = %d, \
    `Arme5` = %d, \
    `Minition5` = %d, \
    `Arme6` = %d, \
    `Minition6` = %d, \
    `Arme7` = %d, \
    `Minition7` = %d \
    WHERE `ID` = %d \
    VALUES('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
    
    pInfo[playerid][Registered],
	pInfo[playerid][Health],
	pInfo[playerid][Armour],
	pInfo[playerid][Mask],
	pInfo[playerid][MaskID],
	pInfo[playerid][SecteID],
	pInfo[playerid][Grade],
	pInfo[playerid][LastPos],
	pInfo[playerid][Mort],
	pInfo[playerid][JailTime],
	pInfo[playerid][Warn],
	pInfo[playerid][Baned],
	pInfo[playerid][HouseOwner],
	pInfo[playerid][BizOwner],
	pInfo[playerid][FacOwner],
	pInfo[playerid][VehicleOwner],
	pInfo[playerid][VehicleOwner2],
	pInfo[playerid][VehicleOwner3],
	pInfo[playerid][Level],
	pInfo[playerid][Exp],
	pInfo[playerid][MaxExp],
	pInfo[playerid][Skin],
	pInfo[playerid][Gender],
	pInfo[playerid][HandMoney],
	pInfo[playerid][BankMoney],
	pInfo[playerid][PhoneNumber],
	pInfo[playerid][PayeCheck],
	pInfo[playerid][PayeTime],
	pInfo[playerid][Amende],
	pInfo[playerid][Facture],
	pInfo[playerid][Emprunt],
	pInfo[playerid][Lotto],
	pInfo[playerid][Permis],
	pInfo[playerid][PermisPoint],
	pInfo[playerid][PortArme],
	pInfo[playerid][Montre],
	pInfo[playerid][Gps],
	pInfo[playerid][Canne],
	pInfo[playerid][Phone],
	pInfo[playerid][Credits],
	pInfo[playerid][CarteIden],
	pInfo[playerid][DrogueFab1],
	pInfo[playerid][DrogueFab2],
	pInfo[playerid][DrogueFab3],
	pInfo[playerid][Cocaine],
	pInfo[playerid][Heroine],
	pInfo[playerid][Ecstacy],
	pInfo[playerid][Weapon1],
	pInfo[playerid][Wep1Ammo],
	pInfo[playerid][Weapon2],
	pInfo[playerid][Wep2Ammo],
	pInfo[playerid][Weapon3],
	pInfo[playerid][Wep3Ammo],
	pInfo[playerid][Weapon4],
	pInfo[playerid][Wep4Ammo],
	pInfo[playerid][Weapon5],
	pInfo[playerid][Wep5Ammo],
	pInfo[playerid][Weapon6],
	pInfo[playerid][Wep6Ammo],
	pInfo[playerid][Weapon7],
	pInfo[playerid][Wep7Ammo],
	pInfo[playerid][pID]
	);
    mysql_tquery(g_iHandle, query, "Apres", "dd", playerid, Creation);
	mysql_tquery(g_iHandle, query);
	return 1;
}
PHP Code:
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(509) : error 075input line too long (after substitutions)
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(510) : error 037invalid string (possibly non-terminated string)
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(510) : error 017undefined symbol "INSERT"
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(510) : error 017undefined symbol "INTO"
C:\Users\Yamaha\Desktop\Serveur Secondair RP\gamemodes\sql.pwn(510) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


5 Errors

And error

PHP Code:
`CashBanque` = %d, \
    `
NumeroTel` = %d, \ 
Sirop is offline   Reply With Quote
Old 04/08/2016, 06:47 PM   #8
Sirop
Big Clucker
 
Sirop's Avatar
 
Join Date: Oct 2015
Posts: 91
Reputation: 2
Default Re: error 001: expected token:

UP pleases
Sirop is offline   Reply With Quote
Old 04/08/2016, 06:55 PM   #9
Shinja
Gangsta
 
Shinja's Avatar
 
Join Date: Jan 2016
Posts: 972
Reputation: 107
Default Re: error 001: expected token:

Error says this line
Quote:
VALUES('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
is too long, use strcat for it
Shinja is offline   Reply With Quote
Old 04/08/2016, 07:22 PM   #10
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,206
Reputation: 681
Default Re: error 001: expected token:

That query looks like a query of someone else's topic yesterday. It's equally bad. Wrapping specifiers in a pair of single quotes is only done when that specifier is replaced by a string (%s, %e,...).

An insert query looks like this:
PHP Code:
INSERT INTO table_name (column1column2column3VALUES (value1value2value3); 
Read Konstantinos' reply again.
AndySedeyn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 001: expected token: alexanderjb918 Scripting Help 2 25/08/2015 08:42 PM
error 001: expected token: It doesn't seem to define. Affan Scripting Help 4 06/04/2015 05:12 AM
Expected token error. MotherDucker Scripting Help 2 02/08/2014 08:56 PM
Help error 001: expected token qmnty Scripting Help 13 12/05/2014 02:59 PM
[HELP] Error (Expected Token) MahmutBey Help Archive 3 26/03/2010 08:11 AM


All times are GMT. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.