PDA

View Full Version : How to load date string from mysql


rocketbunny
21/06/2019, 09:15 AM
Example for register date status in /stats with dialog msgbox
12510
I use varchar 30 for insert.
12511
example date format
12512
I try use
format(string, sizeof(string),"> Register Date \t\t: %s\n", PlayerInfo[playerid][RegisterDate]);
strcat(string2,string);
Doesn't work.
My Code:

CMD:stats(playerid, params[], help)
{
StatsEx(playerid);
return 1;
}

stock StatsEx(playerid)
{
new string2[1024], string[1024], str[1024];

format(string, sizeof(string),"{72cad1}General Info\n");
strcat(string2,string);
format(string, sizeof(string),"{ffffff}> Account ID \t\t\t: #%d\n", PlayerInfo[playerid][pID]);
strcat(string2,string);
format(string, sizeof(string),"> Register Date \t\t: %s\n", PlayerInfo[playerid][RegisterDate]);
strcat(string2,string);
format(string, sizeof(string),"> Last Login \t\t\t: %s\n", PlayerInfo[playerid][LastOnline]);
strcat(string2,string);
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_MSGBOX, str, string2, "OK","");
return 1;
}

RewardK
21/06/2019, 02:05 PM
https://wiki.sa-mp.com/wiki/MySQL/R33#cache_get_field_content

this would help u.

rocketbunny
21/06/2019, 05:45 PM
i'm use R41-4 btw.

rocketbunny
23/06/2019, 10:52 AM
help me

Plastikmensch
23/06/2019, 10:58 AM
RewardK told you how. Use that function where you load data from the database.
Make sure max size of RegisterDate and LastOnline is big enough and they are defined as strings.