MySQL House Problem.
#1

Hello, Iam busy with a MySQL Housing system, But i have a problem...,
When the server shuts down, The houses get saved, But..

It returns everything in the Houses table too 0.0,
Here's my UpdateHouses:

Код:
UpdateHouses()
{
	RefreshMySQL();
	
	new string[512];
    for(new i; i < MAX_HOUSES; i++)
	{
 		format(string, sizeof(string), "UPDATE `houses` SET hDiscription='%s', hEnterX='%.4f', hEnterY='%.4f', hEnterZ='%.4f', hExitX='%.4f' WHERE hID=%d", HouseInfo[i][hDiscription], HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], HouseInfo[i][hExitX], HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hExitY='%.4f', hExitZ='%.4f', hVecPosX='%.4f', hVecPosY='%.4f', hVecPosZ='%.4f' WHERE hID=%d", HouseInfo[i][hExitY], HouseInfo[i][hExitZ], HouseInfo[i][hVecPosX], HouseInfo[i][hVecPosY], HouseInfo[i][hVecPosZ], HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hVecColor1='%d', hVecColor2='%d', hInt='%d', hVir='%d', hPrice='%d' WHERE hID=%d", HouseInfo[i][hVecColor1], HouseInfo[i][hVecColor2], HouseInfo[i][hInt], HouseInfo[i][hVir], HouseInfo[i][hPrice] , HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hOwned='%d', hOwner='%s', hLocked='%d' WHERE hID=%d", HouseInfo[i][hOwned], HouseInfo[i][hOwner], HouseInfo[i][hLocked], HouseInfo[i][hID]);
        mysql_query(string);
	}
	mysql_free_result();
}
Maybe one of you guys know the problem... :S

Greetings, Gforcez
Reply
#2

I didn't spend a lot of time revising your code as it's just too little to understand the way you're getting you system to work. However, are you sure you have everything correct in the MySQL database? If you have defined the default values, it could cause a problem...
Reply
#3

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I didn't spend a lot of time revising your code as it's just too little to understand the way you're getting you system to work. However, are you sure you have everything correct in the MySQL database? If you have defined the default values, it could cause a problem...
i can place a Screen of the MySQL database :P

Here it is:

Click Here!
Reply
#4

Why 4 queries? Do it in only one. And use '' only for strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)