Mysql Help
#1

Not sure if this would be the correct section since its Mysql help but it does involve scripting so my problem I am making a VIP lounge and locker and I am trying to save the location of it using this stock that I made:

Код:
stock saveLounge() { 
	format(szLargeString, sizeof(szLargeString), "UPDATE viplounge SET VIPLoungeExtX = '%f', VIPLoungeExtY = '%f', VIPLoungeExtZ = '%f', VIPLoungeIntX = '%f', VIPLoungeIntY = '%f', VIPLoungeIntZ = %f'", VIPLoungeExt[0], VIPLoungeExt[1], VIPLoungeExt[2], VIPLoungeInt[0], VIPLoungeInt[1], VIPLoungeInt[2]); 
	format(szLargeString, sizeof(szLargeString), "%s, VIPLoungeVW = '%d', VIPLoungeIntID = '%d', VIPLoungeExtVW = '%d'", szLargeString, VIPLoungeVW, VIPLoungeIntID, VIPLoungeExtVW);
	format(szLargeString, sizeof(szLargeString), "%s, VLockerX = '%f', VLockerY = '%f', VLockerZ = '%f', VLockerVW = '%d', VLockerInt = '%d' WHERE loungeid = '1'",szLargeString, VLockerPos[0], VLockerPos[1], VLockerPos[2], VLockerVW, VLockerInt);
	mysql_query(szLargeString);
	return 1;
}
I made the row in Mysql and I made every column I need but for some reason it won't save anything. I made sure to use the stock in my save data command and I load the data when the server starts but after every server restart I have to replace the lounge and the Mysql tables are empty. If you need any other code just tell me, any help is appreciated.
Reply
#2

https://sampwiki.blast.hk/wiki/MySQL#OnQueryError

Print all information in that callback.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MySQL#OnQueryError

Print all information in that callback.
Alright, this is the error I get and I can't make much of it. Hopefully you can:

Код:
[17:15:31] errorid: 1064 | error: 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 '', VIPLoungeVW = '0', VIPLoungeIntID = '0', VIPLoungeExtVW = '0', VLockerX = '0.' at line 1 | resultid: -1 | extraid: -1 | callback: NULL | query: UPDATE viplounge SET VIPLoungeExtX = '667.298645', VIPLoungeExtY = '-1257.560180', VIPLoungeExtZ = '13.460937', VIPLoungeIntX = '0.000000', VIPLoungeIntY = '0.000000', VIPLoungeIntZ = 0.000000', VIPLoungeVW = '0', VIPLoungeIntID = '0', VIPLoungeExtVW = '0', VLockerX = '0.000000', VLockerY = '0.000000', VLockerZ = '0.000000', VLockerVW = '0', VLockerInt = '0' WHERE loungeid = '1'
Reply
#4

Can anyone help me solve this problem? Sorry for the bump but I feel as if its getting buried under all the other help threads.
Reply
#5

well,

small mistake

correct one:

Код:
stock saveLounge() { 
	format(szLargeString, sizeof(szLargeString), "UPDATE viplounge SET VIPLoungeExtX = '%f', VIPLoungeExtY = '%f', VIPLoungeExtZ = '%f', VIPLoungeIntX = '%f', VIPLoungeIntY = '%f', VIPLoungeIntZ = '%f'", VIPLoungeExt[0], VIPLoungeExt[1], VIPLoungeExt[2], VIPLoungeInt[0], VIPLoungeInt[1], VIPLoungeInt[2]); 
	format(szLargeString, sizeof(szLargeString), "%s, VIPLoungeVW = '%d', VIPLoungeIntID = '%d', VIPLoungeExtVW = '%d'", szLargeString, VIPLoungeVW, VIPLoungeIntID, VIPLoungeExtVW);
	format(szLargeString, sizeof(szLargeString), "%s, VLockerX = '%f', VLockerY = '%f', VLockerZ = '%f', VLockerVW = '%d', VLockerInt = '%d' WHERE loungeid = '1'",szLargeString, VLockerPos[0], VLockerPos[1], VLockerPos[2], VLockerVW, VLockerInt);
	mysql_query(szLargeString);
	return 1;
}
NOTE: i have made a BOLD on the missing part.
Reply
#6

Quote:
Originally Posted by kirollos
Посмотреть сообщение
well,

small mistake

correct one:

Код:
stock saveLounge() { 
	format(szLargeString, sizeof(szLargeString), "UPDATE viplounge SET VIPLoungeExtX = '%f', VIPLoungeExtY = '%f', VIPLoungeExtZ = '%f', VIPLoungeIntX = '%f', VIPLoungeIntY = '%f', VIPLoungeIntZ = '%f'", VIPLoungeExt[0], VIPLoungeExt[1], VIPLoungeExt[2], VIPLoungeInt[0], VIPLoungeInt[1], VIPLoungeInt[2]); 
	format(szLargeString, sizeof(szLargeString), "%s, VIPLoungeVW = '%d', VIPLoungeIntID = '%d', VIPLoungeExtVW = '%d'", szLargeString, VIPLoungeVW, VIPLoungeIntID, VIPLoungeExtVW);
	format(szLargeString, sizeof(szLargeString), "%s, VLockerX = '%f', VLockerY = '%f', VLockerZ = '%f', VLockerVW = '%d', VLockerInt = '%d' WHERE loungeid = '1'",szLargeString, VLockerPos[0], VLockerPos[1], VLockerPos[2], VLockerVW, VLockerInt);
	mysql_query(szLargeString);
	return 1;
}
NOTE: i have made a BOLD on the missing part.
Thanks so much, it works perfectly. Damn those little ' marks:P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)