Mysql function problem, mGetLastRegistered();
#1

Hi, I have been trying to make a function which searches my mysql database looking for the last registered player,

So far I have,

pawn Код:
stock mGetLastRegistered()
{
    new tmp[24]="\0";
    if(mCheckConnection()) {
    mysql_query("SELECT * FROM `players` ORDER BY id DESC LIMIT 1");
    mysql_store_result();
    if(mysql_num_rows()) {
        new playername[24];
        new resultline[1024];
        mysql_fetch_row(resultline);
      mysql_fetch_field_row(playername,"playername");
        mysql_free_result();
        strcpy(tmp,playername,24);
        }
    }
    return tmp;
}

@ onplayerconnect I have,

pawn Код:
format(vps,sizeof(vps),"This server has a total of %d registered users, our latest registered player is %s",mGetRegistered(),mGetLastRegistered());
  SendClientMessage(playerid,ChangeNameColour,vps);

Though with this function when I join the server, all mysql related things do not work, I have tryed everything but no success.

I'm using G-Stylezz mysql plugin, can anyone fix this function for me please.
Reply


Messages In This Thread
Mysql function problem, mGetLastRegistered(); - by mini-d - 25.11.2009, 00:07
Re: Mysql function problem, mGetLastRegistered(); - by ExoSanty - 25.11.2009, 13:00
Re: Mysql function problem, mGetLastRegistered(); - by mini-d - 25.11.2009, 17:48
Re: Mysql function problem, mGetLastRegistered(); - by GTA967 - 25.11.2009, 18:43
Re: Mysql function problem, mGetLastRegistered(); - by SoeH - 25.11.2009, 18:51
Re: Mysql function problem, mGetLastRegistered(); - by GTA967 - 25.11.2009, 19:15
Re: Mysql function problem, mGetLastRegistered(); - by mini-d - 25.11.2009, 20:13

Forum Jump:


Users browsing this thread: 1 Guest(s)