27.06.2014, 17:56
hello. how can i retive data in mysql from column without callback?
thanks
thanks
format(str,sizeof(str),"SELECT * FROM accounts WHERE username='%s'",pInfo[playerid][pName]);
new row, field, money;
cache_get_data(row, field, db);
if(rows == 1)
{
cache_get_field_content_int(0,"Money", money, db);
}
You are doing it wrong. What are you fetching from here?:
pawn Код:
pawn Код:
|
native mysql_tquery_inline(connHandle, query[], callback:Callback, format[], {Float,_}:...);
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
new row, field, money;
cache_get_data(row, field, db);
if(rows == 1)
{
cache_get_field_content_int(0,"Money", money, db);
}
}
mysql_format(mysql, query, sizeof(query), "SELECT * FROM playerdata WHERE username = '%e' LIMIT 1", pInfo[playerid][pName]);
mysql_tquery(mysql, query, "LoadAccount", "i", playerid);
Well you will have to create a callback:
pawn Код:
pawn Код:
|
mysql_query("SELECT `Money` FROM `accounts` WHERE `username` = '%s'", pInfo[playerid][pName]);//fetching the data
mysql_store_result();//storing the data
new money = mysql_fetch_int();//inserting the data in your variable
mysql_free_result();//and then removing the data which we stored earlier
Like this:
pawn Код:
|