Mysql input too long..
#1

pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')", BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
I tried strcat but still this error.. how can i make it work ?
Reply
#2

If this is the line where you want to create the biz simply set the defaults in your DB to 0 or w/e

I had the same problem and I fixxed it this way
Reply
#3

Quote:
Originally Posted by Metharon
Посмотреть сообщение
pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')", BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
I tried strcat but still this error.. how can i make it work ?
pawn Код:
format(szQuery, 500, "INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
    mysql_tquery(SQL, szQuery, "", "");
Try this.
e: You can also remove the ' for vars(%d), and the ` for tables/w.e (business)
Reply
#4

Quote:
Originally Posted by Kyance
Посмотреть сообщение
pawn Код:
format(szQuery, 500, "INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
    mysql_tquery(SQL, szQuery, "", "");
Try this.
e: You can also remove the ' for vars(%d), and the ` for tables/w.e (business)

C:\Users\State\Documents\MEGA\Fraggs - Romania\gamemodes\gamemode.pwn(12381 -- 12382) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 8892 bytes
Code size: 977040 bytes
Data size: 3428392 bytes
Stack/heap size: 28000 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 4442324 bytes

1 Warning.
Reply
#5

UP ... i need help .. i never tried to create a long query.
Reply
#6

pawn Код:
new string[350];
strcat(string, "(ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ)");
format(szQuery, 500,"INSERT INTO `business` %s VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
string, BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],
Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);

mysql_tquery(SQL, szQuery, "", "");
Reply
#7

Done , i fixed it.
Reply
#8

pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],
    Bizz[BID][Detinator],
    Bizz[BID][bEntrance],
    Bizz[BID][bInt],
    Bizz[BID][bType],
    Bizz[BID][BDeposit],
    Bizz[BID][BPret],
    Bizz[BID][PickupINT][0],
    Bizz[BID][PickupINT][1],
    Bizz[BID][PickupINT][2],
    Bizz[BID][Ext][0],
    Bizz[BID][Ext][1],
    Bizz[BID][Ext][2],
    Bizz[BID][Int][0],
    Bizz[BID][Int][1],
    Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
Why you don't use mysql_format()
And yeah if you really have some big ass queryes you can split them up. Like half of the data in one query then TQUERY and the rest of after that TQUERY...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)