MySQL Return data issue
#5

Код:
stock GetNameFromCharID(charid)
{
	new query[512];
	mysql_format(MySQLCon, query, 512, "SELECT `username` FROM `characters` WHERE `ID` = %d LIMIT 1", charid);
	return mysql_tquery(MySQLCon, query, "PlayerData", "charid");
}

forward PlayerData(charid);
public PlayerData(charid)
{
	new rows = cache_num_rows(), NameStored[MAX_PLAYER_NAME];
	if(rows) 
	{
		cache_get_row(0, 0, NameStored, .max_len = MAX_PLAYER_NAME);
	}
	return 1;
}
Something like that i think.

You can use the stock here:

Код:
forward OnLookUpVeh(playerid, plate[]);
public OnLookUpVeh(playerid, plate[])
{
        GetNameFromCharID(owner);//Where I want to retrieve the name from
        // and then you can use that NameStored .. but define global NameStored[playerid] something like that
	new rows,fields;
	cache_get_data(rows,fields);
	new id_string[128], carname[48],owner, owner2[MAX_PLAYER_NAME], buytime[128], msg[128];
	cache_get_row(0, 0, id_string);
	format(carname, sizeof(carname), "%s", VehiclesName[strval(id_string)-400]);
	cache_get_row(0,1, id_string);
	owner = strval(id_string);
	cache_get_row(0,2, buytime);
	//GetNameFromCharID(owner);//Where I want to retrieve the name from
	cache_get_row(0,0, owner2);
	format(owner2, sizeof(owner2), "%s", strval(owner2));
	format(msg, sizeof(msg), "Car Name: %s | Owner: %d | Purchased: %s", carname, 0, ReturnDate(buytime));
	return 1;
}
Reply


Messages In This Thread
MySQL Return data issue - by Alex_T - 18.04.2017, 00:22
Re: MySQL Return data issue - by CaRaM3LL - 18.04.2017, 00:28
Re: MySQL Return data issue - by Alex_T - 18.04.2017, 00:30
Re: MySQL Return data issue - by CaRaM3LL - 18.04.2017, 00:32
Re: MySQL Return data issue - by CaRaM3LL - 18.04.2017, 00:43

Forum Jump:


Users browsing this thread: 1 Guest(s)