15.02.2011, 16:47
I have a piece of code which uses the next lines:
And this is GetAccountFromID:
I'm having a problem with the first function, its like it doesn't take any action. When I remvoe the second function's like, it works perfectly.
Is there any problem using 2 MYSQL different queries at the same time? If so, what alternate way can I use?
Thank you.
pawn Код:
mysql_query("SELECT * FROM `Houses`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Query))
{
totalHouses++;
sscanf(Query, "e<p<|>dddffffffdddddddddddddddddddddddddd>", Houses[totalHouses]);
GetPos2DZone(Houses[totalHouses][EnterX], Houses[totalHouses][EnterY], area, sizeof(area));
if(Houses[totalHouses][IsOwned] == 1)
{
printf("OWNER ID: %d (Name: EMPTY)",Houses[totalHouses][OwnerID]);
format(name, sizeof(name), "%s", GetAccountFromID(Houses[totalHouses][OwnerID]));
And this is GetAccountFromID:
pawn Код:
stock GetAccountFromID(id)
{
new Query2[sizeof(Query)];
new name[MAX_PLAYER_NAME];
format(Query2, sizeof(Query), "SELECT `Username` FROM `Accounts` WHERE ID = '%d'", id);
mysql_query(Query2);
mysql_store_result();
if(mysql_num_rows() > 0)
{
if(mysql_fetch_row(Query2))
{
sscanf(Query2, "s[20]",name);
}
}
mysql_free_result();
return name;
}
Is there any problem using 2 MYSQL different queries at the same time? If so, what alternate way can I use?
Thank you.