Mysql saves in database but won't load on restart?
#1

I been messing around with this for hours now trying to fix it and it just will not load backup on the server restart.
i mean it saves within the database it creates the entrance X Y Z and the others etc, i just can't manage to get it loading.

Saving..
Код:
Entrance_Save(entranceid)
{
	static query[1024];

	format(query, sizeof(query), "UPDATE `entrances` SET `entranceName` = '%s', `entrancePass` = '%s', `entranceIcon` = '%d', `entranceLocked` = '%d', `entrancePosX` = '%.4f', `entrancePosY` = '%.4f', `entrancePosZ` = '%.4f', `entrancePosA` = '%.4f', `entranceIntX` = '%.4f', `entranceIntY` = '%.4f', `entranceIntZ` = '%.4f', `entranceIntA` = '%.4f', `entranceInterior` = '%d', `entranceExterior` = '%d', `entranceExteriorVW` = '%d', `entranceType` = '%d'",
	    SQL_ReturnEscaped(EntranceData[entranceid][entranceName]),
	    SQL_ReturnEscaped(EntranceData[entranceid][entrancePass]),
	    EntranceData[entranceid][entranceIcon],
	    EntranceData[entranceid][entranceLocked],
	    EntranceData[entranceid][entrancePos][0],
	    EntranceData[entranceid][entrancePos][1],
	    EntranceData[entranceid][entrancePos][2],
	    EntranceData[entranceid][entrancePos][3],
	    EntranceData[entranceid][entranceInt][0],
	    EntranceData[entranceid][entranceInt][1],
	    EntranceData[entranceid][entranceInt][2],
	    EntranceData[entranceid][entranceInt][3],
	    EntranceData[entranceid][entranceInterior],
	    EntranceData[entranceid][entranceExterior],
	    EntranceData[entranceid][entranceExteriorVW],
	    EntranceData[entranceid][entranceType]
	);
	format(query, sizeof(query), "%s, `entranceCustom` = '%d', `entranceWorld` = '%d' WHERE `entranceID` = '%d'",
	    query,
	    EntranceData[entranceid][entranceCustom],
	    EntranceData[entranceid][entranceWorld],
	    EntranceData[entranceid][entranceID]
	);
	return mysql_function_query(sqlHandle, query, false, "", "");
}
Entrance load
Код:
forward Entrance_Load();
public Entrance_Load()
{
    static
	    rows,
	    fields;

    cache_get_data(rows, fields, g_iHandle);

	for (new i = 0; i < rows; i ++) if (i < MAX_ENTRANCES)
	{
	    EntranceData[i][entranceExists] = true;
    	EntranceData[i][entranceID] = cache_get_field_int(i, "entranceID");

		cache_get_field_content(i, "entranceName", EntranceData[i][entranceName], g_iHandle);
		cache_get_field_content(i, "entrancePass", EntranceData[i][entrancePass], g_iHandle);

	    EntranceData[i][entranceIcon] = cache_get_field_int(i, "entranceIcon");
	    EntranceData[i][entranceLocked] = cache_get_field_int(i, "entranceLocked");
	    EntranceData[i][entrancePos][0] = cache_get_field_float(i, "entrancePosX");
	    EntranceData[i][entrancePos][1] = cache_get_field_float(i, "entrancePosY");
	    EntranceData[i][entrancePos][2] = cache_get_field_float(i, "entrancePosZ");
	    EntranceData[i][entrancePos][3] = cache_get_field_float(i, "entrancePosA");
	    EntranceData[i][entranceInt][0] = cache_get_field_float(i, "entranceIntX");
	    EntranceData[i][entranceInt][1] = cache_get_field_float(i, "entranceIntY");
	    EntranceData[i][entranceInt][2] = cache_get_field_float(i, "entranceIntZ");
	    EntranceData[i][entranceInt][3] = cache_get_field_float(i, "entranceIntA");
	    EntranceData[i][entranceInterior] = cache_get_field_int(i, "entranceInterior");
	    EntranceData[i][entranceExterior] = cache_get_field_int(i, "entranceExterior");
	    EntranceData[i][entranceExteriorVW] = cache_get_field_int(i, "entranceExteriorVW");
	    EntranceData[i][entranceType] = cache_get_field_int(i, "entranceType");
	    EntranceData[i][entranceCustom] = cache_get_field_int(i, "entranceCustom");
	    EntranceData[i][entranceWorld] = cache_get_field_int(i, "entranceWorld");

		if (EntranceData[i][entranceType] == 3)
		    CreateForklifts(i);

	    Entrance_Refresh(i);
	}
	return 1;
}
Код:
stock LoadEntrances()
{
    mysql_function_query(sqlHandle, "SELECT `entranceID`,`entranceName`,`entranceIcon1`,`entrancePosX`,`entrancePosY`,`entrancePosZ`,`entrancePosA`,`entranceIntX`,`entranceIntY`,`entranceIntZ`,`entranceIntA`,`entranceInterior`,`entranceExterior`,`entranceExteriorVW`,`entranceType`,`entrancePass`,`entranceLocked`,`entranceCustom`,`entranceWorld` FROM ` entrances`", true, "Entrance_Load","");
}
Reply
#2

Bump can anybody give a guess i still can't get it working.
Reply
#3

Change this :
Код:
cache_get_field_int
To :
Код:
cache_get_field_content_int
And this :
Код:
mysql_function_query(sqlHandle, "SELECT `entranceID`,`entranceName`,`entranceIcon1`,`entrancePosX`,`entrancePosY`,`entrancePosZ`,`entrancePosA`,`entranceIntX`,`entranceIntY`,`entranceIntZ`,`entranceIntA`,`entranceInterior`,`entranceExterior`,`entranceExteriorVW`,`entranceType`,`entrancePass`,`entranceLocked`,`entranceCustom`,`entranceWorld` FROM ` entrances`", true, "Entrance_Load","");
To :
Код:
mysql_tquery(sqlHandle, "SELECT `entranceID`,`entranceName`,`entranceIcon1`,`entrancePosX`,`entrancePosY`,`entrancePosZ`,`entrancePosA`,`entranceIntX`,`entranceIntY`,`entranceIntZ`,`entranceIntA`,`entranceInterior`,`entranceExterior`,`entranceExteriorVW`,`entranceType`,`entrancePass`,`entranceLocked`,`entranceCustom`,`entranceWorld` FROM ` entrances`", "Entrance_Load");
I hope it'll work, im sorry if im wrong.
Reply
#4

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Change this :
Код:
cache_get_field_int
To :
Код:
cache_get_field_content_int
And this :
Код:
mysql_function_query(sqlHandle, "SELECT `entranceID`,`entranceName`,`entranceIcon1`,`entrancePosX`,`entrancePosY`,`entrancePosZ`,`entrancePosA`,`entranceIntX`,`entranceIntY`,`entranceIntZ`,`entranceIntA`,`entranceInterior`,`entranceExterior`,`entranceExteriorVW`,`entranceType`,`entrancePass`,`entranceLocked`,`entranceCustom`,`entranceWorld` FROM ` entrances`", true, "Entrance_Load","");
To :
Код:
mysql_tquery(sqlHandle, "SELECT `entranceID`,`entranceName`,`entranceIcon1`,`entrancePosX`,`entrancePosY`,`entrancePosZ`,`entrancePosA`,`entranceIntX`,`entranceIntY`,`entranceIntZ`,`entranceIntA`,`entranceInterior`,`entranceExterior`,`entranceExteriorVW`,`entranceType`,`entrancePass`,`entranceLocked`,`entranceCustom`,`entranceWorld` FROM ` entrances`", "Entrance_Load");
I hope it'll work, im sorry if im wrong.
don't think that's going to work however, what about the floats?
cache_get_row_float
Reply
#5

Remove the space from ` entrances` there is a space in ` ` , it should be not there.
And if you are selecting almost all fields then use *
So use this -
Код:
mysql_function_query(sqlHandle, "SELECT * FROM `entrances`", true, "Entrance_Load","");
If this still doesn't works then show your mysql logs.
Reply
#6

Код:
cache_get_field_float
To :
Код:
cache_get_field_content_float
It worked on MySQL R39-2
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
Remove the space from ` entrances` there is a space in ` ` , it should be not there.
And if you are selecting almost all fields then use *
So use this -
Код:
mysql_function_query(sqlHandle, "SELECT * FROM `entrances`", true, "Entrance_Load","");
If this still doesn't works then show your mysql logs.
Used it and it didn't work still not loading.

Am getting this in the mysql log.

Код:
[20:14:03] [ERROR] CMySQLQuery::Execute[Gate_Load()] - (error #1064) 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 '`' at line 1
[20:14:03] [ERROR] CMySQLQuery::Execute[Entrance_Load()] - (error #1054) Unknown column 'id' in 'field list'
[20:17:02] [ERROR] CMySQLQuery::Execute[Gate_Load()] - (error #1064) 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 '`' at line 1
[20:17:02] [ERROR] CMySQLQuery::Execute[Entrance_Load()] - (error #1054) Unknown column 'id' in 'field list'
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:22:33] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
[20:23:56] [ERROR] cache_get_row_int - invalid datatype
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)