Getting String From Mysql Database -
titanak - 12.09.2011
Hello! like title says i want to load string from database , but my version doesn't work.
I Am Using pvars for this:
pawn Код:
new query[300], pname[24], savingstring[20],savingstring2[50];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT skoor, raha, admin, sugu, vanus, vaatamisi, registriaeg FROM kasutajad WHERE kasutajanimi = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "skoor"); SetPlayerScore(playerid, strval(savingstring));
mysql_fetch_field_row(savingstring, "raha"); MoneyGiven[playerid] = strval(savingstring);
mysql_fetch_field_row(savingstring, "admin"); SetPVarInt(playerid, "Admin",strval(savingstring));
mysql_fetch_field_row(savingstring, "sugu"); SetPVarInt(playerid, "Sugu",strval(savingstring));
mysql_fetch_field_row(savingstring, "vanus"); SetPVarInt(playerid, "Vanus",strval(savingstring));
mysql_fetch_field_row(savingstring, "vaatamisi"); SetPVarInt(playerid, "Vaatamisi",strval(savingstring));
mysql_fetch_field_row(savingstring2, "registriaeg"); SetPVarString(playerid,"RegDate",savingstring2);
}
There is something wrong with this line:
pawn Код:
mysql_fetch_field_row(savingstring2, "registriaeg"); SetPVarString(playerid,"RegDate",savingstring2);
but it wont load it. shows empty string, can someone help :P?
Re: Getting String From Mysql Database -
iggy1 - 12.09.2011
If your using G-sTyLeZzZ plugin the put the following code in OnGameModeInit, to see what the query is returning and if there are any problems.
It may or may not help. A file called "debug" will be created in the server directory.
Re: Getting String From Mysql Database -
titanak - 12.09.2011
no im not using. and wrong is not mysql my problem is at pvar i think.
Re: Getting String From Mysql Database -
titanak - 13.09.2011
Can someone say that what is rong at this func??:
pawn Код:
SetPVarString(playerid,"RegDate",savingstring2);
Re: Getting String From Mysql Database -
iggy1 - 13.09.2011
Nothing is wrong with that line of code. Your not getting the value from the DB. See if there is a debug function for your plugin or something similar.
Re: Getting String From Mysql Database -
[HiC]TheKiller - 13.09.2011
He is using G-sTyLeZzZ plugin. The issue is probably that titanak has misspelt the column name in the database.
Re: Getting String From Mysql Database -
titanak - 13.09.2011
but when i add GetPvarString to my format script then it shows empty space .
Re: Getting String From Mysql Database -
[HiC]TheKiller - 13.09.2011
Read what iggy1 said in post #2 then post your result.
Re: Getting String From Mysql Database -
titanak - 13.09.2011
no results.
pawn Код:
,GetPVarString(clickedplayerid, "RegDate",regdate,50) // not wrong ?
Re: Getting String From Mysql Database -
[HiC]TheKiller - 13.09.2011
This is the last time I'm going to try explain this to you. Put mysql_debug(1); at the top of you script. Go into your server directory and find the mysql debug file. Post the contents of that file here.