MySQL - not loading houses.
#1

Okay, so when I restart my server, the houses don't load and I can't find out why..
pawn Код:
LoadHouses()
{
    mysql_function_query(MySQLConnection, "SELECT * FROM `houses`", false, "HouseInformation", "i", THREAD_NO_RESULT);
    return true;
}
pawn Код:
forward HouseInformation(houseid);
public HouseInformation(houseid)
{
    cache_get_data(rows, fields);
    if(rows > 0)
    {
        for(new i = 0; i < rows; i++)
        {
            HouseInfo[i][HouseID] = cache_get_row_int(i, 0, MySQLConnection);
            cache_get_row(i, 1, HouseInfo[i][Owner], MySQLConnection, 24);
            HouseInfo[i][HouseEX] = cache_get_row_float(i, 2, MySQLConnection);
            HouseInfo[i][HouseEY] = cache_get_row_float(i, 3, MySQLConnection);
            HouseInfo[i][HouseEZ] = cache_get_row_float(i, 4, MySQLConnection);
            HouseInfo[i][HouseIX] = cache_get_row_float(i, 5, MySQLConnection);
            HouseInfo[i][HouseIY] = cache_get_row_float(i, 6, MySQLConnection);
            HouseInfo[i][HouseIZ] = cache_get_row_float(i, 7, MySQLConnection);
            HouseInfo[i][Weed] = cache_get_row_int(i, 8, MySQLConnection);
            HouseInfo[i][Money] = cache_get_row_int(i, 9, MySQLConnection);
            HouseInfo[i][Locked] = cache_get_row_int(i, 10, MySQLConnection);
            HouseInfo[i][Price] = cache_get_row_int(i, 11, MySQLConnection);
            HouseInfo[i][Interior] = cache_get_row_int(i, 12, MySQLConnection);
           
           
        }
    }
    return true;
}
Reply
#2

set the cache to true
Reply
#3

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
set the cache to true
Nope, still not. Help?
Reply
#4

Anyone?
Reply
#5

You need cache and no arguments since you select all of them and use a loop later.

pawn Код:
stock LoadHouses()
{
    mysql_function_query(MySQLConnection, "SELECT * FROM houses", true, "OnHousesLoad", "");
}

forward OnHousesLoad();
public OnHousesLoad()
{
    new irows, ifields; // better as local
    cache_get_data(irows, ifields);
    for(new i = 0; i < rows; i++)
    {
        HouseInfo[i][HouseID] = cache_get_row_int(i, 0, MySQLConnection);
        cache_get_row(i, 1, HouseInfo[i][Owner], MySQLConnection, 24);
        HouseInfo[i][HouseEX] = cache_get_row_float(i, 2, MySQLConnection);
        HouseInfo[i][HouseEY] = cache_get_row_float(i, 3, MySQLConnection);
        HouseInfo[i][HouseEZ] = cache_get_row_float(i, 4, MySQLConnection);
        HouseInfo[i][HouseIX] = cache_get_row_float(i, 5, MySQLConnection);
        HouseInfo[i][HouseIY] = cache_get_row_float(i, 6, MySQLConnection);
        HouseInfo[i][HouseIZ] = cache_get_row_float(i, 7, MySQLConnection);
        HouseInfo[i][Weed] = cache_get_row_int(i, 8, MySQLConnection);
        HouseInfo[i][Money] = cache_get_row_int(i, 9, MySQLConnection);
        HouseInfo[i][Locked] = cache_get_row_int(i, 10, MySQLConnection);
        HouseInfo[i][Price] = cache_get_row_int(i, 11, MySQLConnection);
        HouseInfo[i][Interior] = cache_get_row_int(i, 12, MySQLConnection);
    }
}
Reply
#6

Nope, still not loading.
Reply
#7

Quote:
Originally Posted by Zeppo
Посмотреть сообщение
Nope, still not loading.
Post your MySQL debug.
Reply
#8

Код:
[20:22:43] [WARNING] cache_get_data - no active cache
[20:23:03] [ERROR] CMySQLQuery::Execute[Query] - (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 '`, `Cash` = 3500, `Accounts` SET `Admin` = 5, `HouseID` = 0 WHE' at line 1
I've fixed the second one.
Reply
#9

It seems to be from this:
pawn Код:
forward OnHousesLoad();
public OnHousesLoad()
{
    new irows, ifields;
    cache_get_data(irows, ifields);
    for(new i = 0; i < irows; i++)
    {
        HouseInfo[i][HouseID] = cache_get_row_int(i, 0, MySQLConnection);
        cache_get_row(i, 1, HouseInfo[i][Owner], MySQLConnection, 24);
        HouseInfo[i][HouseEX] = cache_get_row_float(i, 2, MySQLConnection);
        HouseInfo[i][HouseEY] = cache_get_row_float(i, 3, MySQLConnection);
        HouseInfo[i][HouseEZ] = cache_get_row_float(i, 4, MySQLConnection);
        HouseInfo[i][HouseIX] = cache_get_row_float(i, 5, MySQLConnection);
        HouseInfo[i][HouseIY] = cache_get_row_float(i, 6, MySQLConnection);
        HouseInfo[i][HouseIZ] = cache_get_row_float(i, 7, MySQLConnection);
        HouseInfo[i][Weed] = cache_get_row_int(i, 8, MySQLConnection);
        HouseInfo[i][Money] = cache_get_row_int(i, 9, MySQLConnection);
        HouseInfo[i][Locked] = cache_get_row_int(i, 10, MySQLConnection);
        HouseInfo[i][Price] = cache_get_row_int(i, 11, MySQLConnection);
        HouseInfo[i][Interior] = cache_get_row_int(i, 12, MySQLConnection);
    }
}
Reply
#10

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)