[PROBLEM] Splitting rows with sscanf -
zombieking - 28.03.2013
This is the code I have:
pawn Код:
new Query[80];
for(new i=0; i < MAX_BIZ; i++)
{
format(Query, sizeof(Query), "SELECT * FROM `Business` WHERE 'bID' = '%d' ",i);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>iiis[24]iiiffffffffiiiiiis[128]>", BusinessInfo[i]);
BusinessInfo[i][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[i][bEntranceX], BusinessInfo[i][bEntranceY], BusinessInfo[i][bEntranceZ], BusinessInfo[i][bWorld]); //Creates a pickup at the business entrance.
BusinessInfo[i][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[i][bExitX], BusinessInfo[i][bExitY], BusinessInfo[i][bExitZ], BusinessInfo[i][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
printf("EntranceX: %f\nEntranceY: %f\nEntranceZ: %f",BusinessInfo[i][bEntranceX],BusinessInfo[i][bEntranceY],BusinessInfo[i][bEntranceZ]);
mysql_free_result();
}
And the enum:
pawn Код:
enum bInfo {
bID,
bOwned,
bPrice,
bOwner[MAX_PLAYER_NAME],
bType,
bLocked,
bMoney,
Float:bEntranceX,
Float:bEntranceY,
Float:bEntranceZ,
Float:bEntranceA,
Float:bExitX,
Float:bExitY,
Float:bExitZ,
Float:bExitA,
bInt,
bWorld,
bInsideInt,
bInsideWorld,
bInsideIcon,
bOutsideIcon,
bName[128]
}
When loading, the X,Y and Z positions are always 0 and I have no idea why
Re: [PROBLEM] Splitting rows with sscanf -
InfiniTy. - 28.03.2013
pawn Код:
sscanf(Query, "p<|>e<iiis[24]iiiffffffffiiiiiis[128]>", BusinessInfo[i]);
I might be wrong tho.
Re: [PROBLEM] Splitting rows with sscanf -
zombieking - 28.03.2013
Same, doesn't work.
Re: [PROBLEM] Splitting rows with sscanf -
InfiniTy. - 28.03.2013
Quote:
Originally Posted by zombieking
Same, doesn't work.
|
It's only the floats that don't load ?
Re: [PROBLEM] Splitting rows with sscanf -
zombieking - 28.03.2013
The floats do save correctly but do not load. Other stats load fine.
EDIT: Actually, nothing loads correctly.
Re: [PROBLEM] Splitting rows with sscanf - Riddy - 28.03.2013
You do know you use 'P' for that now?
At least thats what I read in a update by Y Less
Re: [PROBLEM] Splitting rows with sscanf -
InfiniTy. - 28.03.2013
Quote:
Originally Posted by zombieking
The floats do save correctly but do not load. Other stats load fine.
EDIT: Actually, nothing loads correctly.
|
Maybe the query isn't executed successfully ? Did you try looking into mysql_log ? To see if the query works ? ;-?
@Riddy
"You can now have optional delimiters using "P" (upper case "p" to match other "optional" specifiers). These are optional in the sense that you specify multiple delimiters and any one of them can be used to end the next symbol:"
ps. yea you just told me nothing loads.. did you check mysql_log?
pss. Try changing your query to
pawn Код:
SELECT * FROM `Business` WHERE bID = %d
Re: [PROBLEM] Splitting rows with sscanf -
zombieking - 28.03.2013
Nothing loads correctly, not even the integers
EDIT: Just saw your post:
Код:
CMySQLHandler::Query(SELECT * FROM `Business` WHERE 'bID' = '1' ) - Successfully executed.
[21:02:07] >> mysql_store_result( Connection handle: 1 )
That's exactly how my query looks like.
EDIT: Changing my query to what you suggested works! Thank you very much! +REP