[HELP] Loading business from database
#1

I have a function that is enabled when the server starts but the business are not loading...

Код:
stock AddBizFromFile()
{
	new
		Str[67],
		dID,
		Float:bX,
		Float:bY,
		Float:bZ,
		vTotal;

    mysql_query("SELECT * FROM `Business`");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>iffff", dID, bX, bY, bZ);
            AddStaticPickup(1272,2, bX, bY, bZ, 0);
			vTotal++;
		}
    }
    mysql_free_result();
    printf("** %i\t<->\tBiz Loaded From\t<->\tMySQL\t\t   **", vTotal);
	return 1;
}
I have this on my MySql log:

Quote:

[00:31:48] CMySQLHandler::Query(SELECT * FROM `Business`) - Successfully executed.

[00:31:48] >> mysql_store_result( Connection handle: 1 )

[00:31:48] CMySQLHandler::StoreResult() - Result was stored.

[00:31:48] >> mysql_num_rows( Connection handle: 1 )

[00:31:48] CMySQLHandler::NumRows() - Returned 2 rows(s)

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] CMySQLHandler::FetchRow() - Return: 1|215.866|14.568|2.5708|Lucca_Xavier|Oficina Mecanica do Tabareu|5000|250000

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] CMySQLHandler::FetchRow() - Return: 2|73.6155|-219.452|1.5825|Governo|Policia Militar|10000|1000000

[00:31:48] >> mysql_fetch_row_format( Connection handle: 1 )

[00:31:48] >> mysql_free_result( Connection handle: 1 )

[00:31:48] CMySQLHandler::FreeResult() - Result was successfully free'd.

[00:32:11] >> mysql_real_escape_string( Connection handle: 1 )

Can anyone help me? The icons just don't appear...
Reply
#2

Fixed, allways be carefull with sscanf

sscanf(Str, "p<|>iffff", dID, bX, bY, bZ);

I had one more f
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)