[HELP] Usins sscanf and mysql.. dont understand
#1

hey... someone give me this code for get data from a mysql database

Код:
LoadData(playerid)
{
  new
    pName[24],
    query[61],
    line[100];

  GetPlayerName(playerid, pName, 24);
  mysql_real_escape_string(pName, pName);
  format(query, sizeof(query), "SELECT * FROM jugadores WHERE nombre='%s'", pName); // we check and get the gata from that name
  mysql_query(query);
  mysql_store_result(); // we store the result.
  mysql_fetch_row_format(line, "."); // we set a delimiter
  sscanf(line, ".", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]); // this will get the first 3 fields into pinfo[playerid][playeri]
  mysql_free_result();
  new textto[128];
  format(textto, sizeof(textto), "Your pass is: %s", pinfo[playerid][pass]);
  SendClientMessage(playerid, COLOR_LIGHTBLUE, textto);
  return 1;
}
Wheell this saids "Your pass is:" but no saids the PASS .. example "Your pass is: 515gf6h5fh" like that :/ ...

so i dont understand the code and this part is rare... here

Код:
sscanf(line, "p.sdd", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]); // this will get the first 3 fields into pinfo[playerid][playeri]
i dont understand "sscanf(line, "p.sdd"," what is the "p.sdd"

Any one can help me? plss
Reply
#2

please help me. i dont understand the code dont take data from sql
Reply
#3

pawn Код:
sscanf(line, ".", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
needs to be
pawn Код:
sscanf(line, "p.issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
Reply
#4

Quote:
Originally Posted by Daren_Jacobson
pawn Код:
sscanf(line, ".", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
needs to be
pawn Код:
sscanf(line, "p.issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
OHH THx a looooot!! workss its workss!! jeje i love you :$ XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)