Erro Mysql
#1

Hello I am creating a house system in mysql, everything works perfect except that loads something wrong and cause error in the label of the house.

This load the houses:

Код:
		case LOAD_HOUSE:
		{
            new rows, fields;
			cache_get_data(rows,fields,TuberiasMySQL);
			if(rows)
			{
				for(new i; i < rows; i++)
				{
		        	new contenido[364];
    			 	format(Query, sizeof(Query), "SELECT id FROM houses ORDER BY id DESC");
    			 	mysql_function_query(TbMySQL, Query, true, "OnQueryFinish", "i", NOT_RESULT);
					cache_get_field_content(i, "id", contenido);HouseInfo[i][cID] = strval(contenido);
					cache_get_field_content(i, "x", contenido);HouseInfo[i][cx] = floatstr(contenido);
					cache_get_field_content(i, "y", contenido);HouseInfo[i][cy] = floatstr(contenido);
					cache_get_field_content(i, "z", contenido);HouseInfo[i][cz] = floatstr(contenido);
					cache_get_field_content(i, "a", contenido);HouseInfo[i][ca] = floatstr(contenido);
					cache_get_field_content(i, "xx", contenido);HouseInfo[i][cxx] = floatstr(contenido);
					cache_get_field_content(i, "yy", contenido);HouseInfo[i][cyy] = floatstr(contenido);
					cache_get_field_content(i, "zz", contenido);HouseInfo[i][czz] = floatstr(contenido);
					cache_get_field_content(i, "aa", contenido);HouseInfo[i][caa] = floatstr(contenido);
					cache_get_field_content(i, "gcx", contenido);HouseInfo[i][cgx] = floatstr(contenido);
					cache_get_field_content(i, "gcy", contenido);HouseInfo[i][cgy] = floatstr(contenido);
					cache_get_field_content(i, "gcz", contenido);HouseInfo[i][cgz] = floatstr(contenido);
					cache_get_field_content(i, "gxx", contenido);HouseInfo[i][cgxx] = floatstr(contenido);
					cache_get_field_content(i, "gyy", contenido);HouseInfo[i][cgyy] = floatstr(contenido);
					cache_get_field_content(i, "gzz", contenido);HouseInfo[i][cgzz] = floatstr(contenido);
					cache_get_field_content(i, "gInterior", contenido);HouseInfo[i][cgInt] = strval(contenido);
					cache_get_field_content(i, "gVw", contenido);HouseInfo[i][cgVw] = strval(contenido);
					cache_get_field_content(i, "gLock", contenido);HouseInfo[i][cgLock] = strval(contenido);
					cache_get_field_content(i, "Garage", contenido);HouseInfo[i][cGarage] = strval(contenido);
        			cache_get_field_content(i, "Money", contenido);HouseInfo[i][cMoney] = strval(contenido);
        			cache_get_field_content(i, "Price", contenido);HouseInfo[i][cPrice] = strval(contenido);
        			cache_get_field_content(i, "Int", contenido);HouseInfo[i][cInt] = strval(contenido);
        			cache_get_field_content(i, "Vw", contenido);HouseInfo[i][cVw] = strval(contenido);
        			for(new a; a < 5; a++)
        			{
        		    	new str[9];
        		    	format(str, sizeof(str), "ArmID%0", a);
        		    	cache_get_field_content(i, str, contenido);
        		    	HouseInfo[i][cArmID][a] = strval(contenido);
					}
					for(new b; b < 5; b++)
					{
						new str[15];
						format(str, sizeof(str), "ArmCantidad%d", b);
                    	cache_get_field_content(i, str, contenido);
						HouseInfo[i][cArmCantidad][b] = strval(contenido);
        			}
        			for(new c; c < 5; c++)
        			{
        		    	new str[10];
        		    	format(str, sizeof(str), "ArmTipo%d", c);
						cache_get_field_content(i, str, contenido);
						HouseInfo[i][cArmTipo][c] = strval(contenido);
					}
        			cache_get_field_content(i, "Arm", contenido);HouseInfo[i][cArm] = strval(contenido);
       				cache_get_field_content(i, "Cerrada", contenido);HouseInfo[i][cCerrada] = strval(contenido);
                    cache_get_field_content(i, "Comprador", HouseInfo[i][cComprador]);
        			cache_get_field_content(i, "Descripcion", HouseInfo[i][cDescripcion]);
        			cache_get_field_content(i, "Alquiler", contenido);HouseInfo[i][cAlquiler] = strval(contenido);
        			cache_get_field_content(i, "PrecioAlquiler", contenido);HouseInfo[i][cPrecioAlquiler] = strval(contenido);
       		 		cache_get_field_content(i, "Alquilados", contenido);HouseInfo[i][cAlquilados] = strval(contenido);
        			cache_get_field_content(i, "Comprada", contenido);HouseInfo[i][cComprada] = strval(contenido);
        			cache_get_field_content(i, "CajaFuerte", contenido);HouseInfo[i][cCajaFuerte] = strval(contenido);
        			cache_get_field_content(i, "Alarma", contenido);HouseInfo[i][cAlarma] = strval(contenido);
        			cache_get_field_content(i, "Puerta", contenido);HouseInfo[i][cPuerta] = strval(contenido);
        			cache_get_field_content(i, "Direccion", HouseInfo[i][cDirec]);

					HouseInfo[i][cPickup] = CreateDynamicPickup(1273, 1, HouseInfo[i][cx], HouseInfo[i][cy], HouseInfo[i][cz]);
	                HouseInfo[i][cLabel] = CreateDynamic3DTextLabel("", 0x00B50093, HouseInfo[i][cx], HouseInfo[i][cy], HouseInfo[i][cz]+0.5,5.0);
	                HouseInfo[i][cgPickup] = CreateDynamicPickup(1239, 1, HouseInfo[i][cgx], HouseInfo[i][cgy], HouseInfo[i][cgz]);
	                HouseInfo[i][cgLabel] = CreateDynamic3DTextLabel("", 0x006BBB95, HouseInfo[i][cgx], HouseInfo[i][cgy], HouseInfo[i][cgz]+0.5, 5.0);
                    UpdateHouseLabel(i);
                    Totalhouses = rows;

				}
                print( " \n|---- HOUSE SYSTEM ----|");
				printf(" Houses: %d (MAX: %d)",rows,MAX_HOUSES);
			}else if(!rows)
			{
				print(" \n|---- HOUSE SYSTEM ----|\n No houses to load!");
			}
All load perfectly except this content (HouseInfo[i][cComprador]) and (HouseInfo[i][cDirec], i don't know if i don't using the correct functions to load the string that have (%s), i'm using MySQL r38, sorry for my bad english
Reply
#2

Try this:

Код:
// Add the string
cache_get_field_content(i, "Comprador", string);
format(HouseInfo[i][cComprador], sizeof(string), string);
cache_get_field_content(i, "Direccion", string);
format(HouseInfo[i][cDirec], sizeof(string), string);
Reply
#3

EDIT: i think your code is just fine....
becouse i do that too and i have no error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)