SQL Loading Issue - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL Loading Issue (
/showthread.php?tid=590633)
SQL Loading Issue -
austin070 - 02.10.2015
Am I doing something wrong with this? For some reason it's not loading any of the information correctly.
pawn Код:
public LoadHouses()
{
new rows, fields;
cache_get_data(rows, fields);
HouseCount = rows;
for(new i = 1; i <= rows; i++)
{
cache_get_field_content(i, "owner", HouseInfo[i][Owner], g_Handle, 24);
HouseInfo[i][Status] = cache_get_field_content_int(i, "status");
HouseInfo[i][Interior] = cache_get_field_content_int(i, "interior");
HouseInfo[i][Price] = cache_get_field_content_int(i, "price");
HouseInfo[i][XPos] = cache_get_field_content_float(i, "xpos");
HouseInfo[i][YPos] = cache_get_field_content_float(i, "ypos");
HouseInfo[i][ZPos] = cache_get_field_content_float(i, "zpos");
HouseInfo[i][EnterX] = cache_get_field_content_float(i, "enterx");
HouseInfo[i][EnterY] = cache_get_field_content_float(i, "entery");
HouseInfo[i][EnterZ] = cache_get_field_content_float(i, "enterz");
HousePickup[i] = CreatePickup(1273, 1, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos]);
CreateHouseLabels(i);
}
printf("--- %i houses loaded from the SQL Database. ---", HouseCount);
return 1;
}
And my sql log
Код:
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_int - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
[20:08:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[20:08:02] [ERROR] cache_get_field_content_float - invalid datatype
AW: SQL Loading Issue -
Kaliber - 02.10.2015
start at new i=0
Re: SQL Loading Issue -
austin070 - 02.10.2015
I had that before and I was getting a similar issue. I found that the issue was in my declaration of HouseCount. Thank you.
Re: SQL Loading Issue -
xVIP3Rx - 02.10.2015
Not too important, but why are you using those local vars for rows and fields, consider doing this.
pawn Код:
public LoadHouses()
{
HouseCount = cache_get_row_count();
for(new i; i <= HouseCount; i++)
{
cache_get_field_content(i, "owner", HouseInfo[i][Owner], g_Handle, 24);
HouseInfo[i][Status] = cache_get_field_content_int(i, "status");
HouseInfo[i][Interior] = cache_get_field_content_int(i, "interior");
HouseInfo[i][Price] = cache_get_field_content_int(i, "price");
HouseInfo[i][XPos] = cache_get_field_content_float(i, "xpos");
HouseInfo[i][YPos] = cache_get_field_content_float(i, "ypos");
HouseInfo[i][ZPos] = cache_get_field_content_float(i, "zpos");
HouseInfo[i][EnterX] = cache_get_field_content_float(i, "enterx");
HouseInfo[i][EnterY] = cache_get_field_content_float(i, "entery");
HouseInfo[i][EnterZ] = cache_get_field_content_float(i, "enterz");
HousePickup[i] = CreatePickup(1273, 1, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos]);
CreateHouseLabels(i);
}
printf("--- %i houses loaded from the SQL Database. ---", HouseCount);
return 1;
}