MySQL Inserting...
#1

Well i had to do this because of the error input size too long so i needed to ask...
Is this the best way to do this? I mean is there any better way doing this because it doesn't seem perfect so if you guys can help me out and tell me is it good or bad..

Код:
new query[512], query2[512];
	mysql_format(mysql, query, sizeof(query), "INSERT INTO `"TABLE_HOUSES"` (`Price`, `Owned`, `Owner`, `EntX`, `EntY`, `EntZ`, `ExX` ,`ExY`, `ExZ`, `VirWorld`, `Int`)");
	mysql_format(mysql, query2, sizeof(query2), "VALUES ('%d', '%d', '%s', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",\
 	HouseInfo[HouseID][Price], HouseInfo[HouseID][Owned], HouseInfo[HouseID][Owner], HouseInfo[HouseID][EntX], HouseInfo[HouseID][EntY], HouseInfo[HouseID][EntZ], HouseInfo[HouseID][ExX], HouseInfo[HouseID][ExY],\
  	HouseInfo[HouseID][ExZ], HouseInfo[HouseID][VirtualWorld], HouseInfo[HouseID][Interior]);
    strcat(query, query2);
	mysql_query(mysql, query);
Thanks.
Reply
#2

Is this creating a house?
Reply
#3

Yeah.

Do you think that the format is good or bad?
I mean didn't ever used strcat but i had to because the line was too long tho..
Reply
#4

pawn Код:
new query[1024];
format(query, sizeof(query), "INSERT INTO `HOUSES` (Price, Owned, Owner, etc. ,) VALUES ('%d', '%d', '%s)",
HouseInfo[HouseID][Price],
HouseInfo[HouseID][Owned],
HouseInfo[HouseID][Owner],
etc.

mysql_query(mysql, query);
I would maybe do it like that.
Reply
#5

OMG i forgot about this LOL Thanks man LMAO...

Rep+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)