mysql loading problem
#1

pawn Code:
stock LoadHousesFromDatabase()
{
    new Query[255],datavar[6],datastr[1][28],Float:datafloat[7];
    mysql_query("SELECT * FROM `Houses` ORDER BY  `Houses`.`Houseid` ASC LIMIT 0,260");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row_format(Query,"|"))
        {
            sscanf(Query,"p<|>ds[27]dfffffffdddd",datavar[0],datastr[0],datavar[1],datafloat[0],datafloat[1],
            datafloat[2],datafloat[3],datafloat[4],datafloat[5],datafloat[6],datavar[2],datavar[3],datavar[4],datavar[5]);
            CreateHouse(datavar[0], datafloat[1], datafloat[2], datafloat[3],datafloat[0], datafloat[4],datafloat[5],datafloat[6], datavar[2],  datavar[4], datavar[5]);
        }
    }
    mysql_free_result();
    return 1;
}
it only loads houseid 0. S: any ideas?

Code:
[13:07:42] CMySQLHandler::Query(SELECT * FROM `Houses` ORDER BY  `Houses`.`Houseid` ASC LIMIT 0,260) - Successfully executed.

[13:07:42] >> mysql_store_result( Connection handle: 1 )

[13:07:42] CMySQLHandler::StoreResult() - Result was stored.

[13:07:42] >> mysql_num_rows( Connection handle: 1 )

[13:07:42] CMySQLHandler::NumRows() - Returned 242 row(s)

[13:07:42] >> mysql_fetch_row_format( Connection handle: 1 )

[13:07:42] CMySQLHandler::FetchRow() - Return: 0|Nothing|0|27.38|1452.31|2773.87|266.57|2324.41|-1145.56|1050.71|12|250148|0|0|Unbought|0|0|0|0|Nobody||0|0|0||||||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0

[13:07:42] >> mysql_query( Connection handle: 1 )

[13:07:42] CMySQLHandler::Query(SELECT * FROM Houses WHERE Houseid = 0 LIMIT 1) - Successfully executed.

[13:07:42] >> mysql_store_result( Connection handle: 1 )

[13:07:42] CMySQLHandler::StoreResult() - Result was stored.

[13:07:42] >> mysql_num_rows( Connection handle: 1 )

[13:07:42] CMySQLHandler::NumRows() - Returned 1 row(s)

[13:07:42] >> mysql_fetch_row_format( Connection handle: 1 )

[13:07:42] CMySQLHandler::FetchRow() - Return: 0|Nothing|0|27.38|1452.31|2773.87|266.57|2324.41|-1145.56|1050.71|12|250148|0|0|Unbought|0|0|0|0|Nobody||0|0|0||||||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0

[13:07:42] >> mysql_free_result( Connection handle: 1 )

[13:07:42] CMySQLHandler::FreeResult() - Result was successfully free'd.

[13:07:42] >> mysql_free_result( Connection handle: 1 )

[13:07:42] CMySQLHandler::FreeResult() - The result is already empty.
Reply
#2

Remove LIMIT 0,260.
Reply
#3

Try changing your query to this:
pawn Code:
SELECT * FROM `Houses` ORDER BY `Houseid` ASC LIMIT 260
Reply
#4

it happens even without the order by and just select * from houses
it works if i load by id, but i dont want that its to slow

pawn Code:
stock LoadHousesFromDatabase()
{
    new Query[255],datavar[6],datastr[1][28],Float:datafloat[7];
    mysql_query("SELECT * FROM `Houses` ORDER BY `Houseid` ASC LIMIT 260");
    mysql_store_result();
    if(mysql_num_rows())
    if(mysql_fetch_row_format(Query,"|"))
    {
        sscanf(Query,"p<|>ds[27]dfffffffdddd",datavar[0],datastr[0],datavar[1],datafloat[0],datafloat[1],
        datafloat[2],datafloat[3],datafloat[4],datafloat[5],datafloat[6],datavar[2],datavar[3],datavar[4],datavar[5]);
        CreateHouse(datavar[0], datafloat[1], datafloat[2], datafloat[3],datafloat[0], datafloat[4],datafloat[5],datafloat[6], datavar[2],  datavar[4], datavar[5]);
    }
    mysql_free_result();
    return 1;
}

19:15:48] >> mysql_query( Connection handle: 1 )

[19:15:49] CMySQLHandler::Query(SELECT * FROM `Houses` ORDER BY `Houseid` ASC LIMIT 260) - Successfully executed.

[19:15:49] >> mysql_store_result( Connection handle: 1 )

[19:15:49] CMySQLHandler::StoreResult() - Result was stored.

[19:15:49] >> mysql_num_rows( Connection handle: 1 )

[19:15:49] CMySQLHandler::NumRows() - Returned 242 row(s)

[19:15:49] >> mysql_fetch_row_format( Connection handle: 1 )

[19:15:49] CMySQLHandler::FetchRow() - Return: 0|Nothing|0|27.38|1452.31|2773.87|266.57|2324.41|-1145.56|1050.71|12|250148|0|0|Unbought|0|0|0|0|Nobody||0|0|0||||||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0

[19:15:49] >> mysql_query( Connection handle: 1 )

[19:15:49] CMySQLHandler::Query(SELECT * FROM Houses WHERE Houseid = 0 LIMIT 1) - Successfully executed.

[19:15:49] >> mysql_store_result( Connection handle: 1 )

[19:15:49] CMySQLHandler::StoreResult() - Result was stored.

[19:15:49] >> mysql_num_rows( Connection handle: 1 )

[19:15:49] CMySQLHandler::NumRows() - Returned 1 row(s)

[19:15:49] >> mysql_fetch_row_format( Connection handle: 1 )

[19:15:49] CMySQLHandler::FetchRow() - Return: 0|Nothing|0|27.38|1452.31|2773.87|266.57|2324.41|-1145.56|1050.71|12|250148|0|0|Unbought|0|0|0|0|Nobody||0|0|0||||||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0

[19:15:49] >> mysql_free_result( Connection handle: 1 )

[19:15:49] CMySQLHandler::FreeResult() - Result was successfully free'd.

[19:15:49] >> mysql_free_result( Connection handle: 1 )

[19:15:49] CMySQLHandler::FreeResult() - The result is already empty.

[19:15:50] >> mysql_query( Connection handle: 1 )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)