mysql create table
#1

I have this code:

when i want to add another var like:
`tester` int(11) NOT NULL, \
after bannedby it won't let me..

it says:
erp.pwn(531) : error 075: input line too long (after substitutions)

Код:
	mysql_function_query(dbHandle, "CREATE TABLE IF NOT EXISTS `users` ( \
		`id` int(11) NOT NULL AUTO_INCREMENT, \
		`name` varchar(24) NOT NULL, \
		`password` varchar(129) NOT NULL, \
		`cash` int(11) NOT NULL, \
		`level` int(11) NOT NULL, \
		`skin` int(3) NOT NULL, \
		`admin` int(3) NOT NULL, \
		`sex` int(3) NOT NULL, \
		`age` int(11) NOT NULL, \
		`origin` varchar(129) NOT NULL, \
		`deaths` int(11) NOT NULL, \
		`banned` int(3) NOT NULL, \
		`bannedby` varchar(129) NOT NULL, \
		PRIMARY KEY (`id`) \
	)", false, "SendQuery", "");
Reply
#2

pawn Код:
new
    iStr[1024]
;
strcat(iStr, "CREATE TABLE IF NOT EXISTS `users`(`id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(24) NOT NULL, ");
strcat(iStr, "`password` varchar(129) NOT NULL, `cash` int(11) NOT NULL, `level` int(11) NOT NULL, `skin` int(3) NOT NULL, ");
strcat(iStr, "`admin` int(3) NOT NULL, `sex` int(3) NOT NULL, `age` int(11) NOT NULL, `origin` varchar(129) NOT NULL, `deaths` int(11) NOT NULL, ");
strcat(iStr, "`banned` int(3) NOT NULL, `bannedby` varchar(129) NOT NULL,PRIMARY KEY (`id`))");
mysql_function_query(dbHandle, iStr, false, "", "");
Reply
#3

I recommend creating tables manually. The table structure is not likely to change frequently so including this into your script is pretty much a waste. You can still save the SQL code in a file and (manually) execute it on your MySQL server when needed.
Reply
#4

okay thanks, one more question.

I have this code:
it doesn't works...'

Код:
stock SaveAccount(playerid)
{
	new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    pInfo[playerid][pPosX] = x;
    pInfo[playerid][pPosY] = y;
    pInfo[playerid][pPosZ] = z;
    pInfo[playerid][pPosA] = a;
	
    new query[300];
    format(query, sizeof(query), "UPDATE `users` SET cash=%d, level=%d, admin=%d, skin=%d, sex=%d, origin='%s', deaths=%d, banned=%d, bannedby='%s', posx=%f, posy=%f, posz=%f, posa=%f  WHERE id=%d",
	GetCash(playerid),
	pInfo[playerid][pLevel],
	pInfo[playerid][pAdmin],
	pInfo[playerid][pSkin],
	pInfo[playerid][pSex],
	pInfo[playerid][pOrigin],
	pInfo[playerid][pDeaths],
	pInfo[playerid][pBanned],
	pInfo[playerid][pBannedBy],
	pInfo[playerid][pPosX],
    pInfo[playerid][pPosY],
    pInfo[playerid][pPosZ],
    pInfo[playerid][pPosA],
	pInfo[playerid][pSQLid]);
	
	mysql_function_query(dbHandle, query, false, "", "");
	return 1;
}
Reply
#5

nvm ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)