SQLite
#1

how to get field text on SQLite

Код:
				db_get_field_assoc(qresult, "Label_ID", value, 5); // Label ID
				LabelInfo[i][LabelID] = strval(value);

				db_get_field_assoc(qresult, "Label_Text", value, 30); // Label Text
				LabelInfo[i][LabelText] = How to get the text :/
sorry for my bad english
Reply
#2

This way:
PHP код:
format(LabelInfo[i][LabelText], 64value); 
Or using function strmid.
Reply
#3

You should use the corresponding function
PHP код:
LabelInfo[i][LabelID] = db_get_field_assoc_int(qresult"Label_ID"); // Label ID
db_get_field_assoc(qresult"Label_Text"LabelInfo[i][LabelText], 30); // Label Text 
Quote:
Originally Posted by a_sampdb.inc
native db_get_field(DBResult:dbresult, field, result[], maxlength);
native db_get_field_int(DBResult:result, field = 0);
native Float:db_get_field_float(DBResult:result, field = 0);

native db_get_field_assoc(DBResult:dbresult, const field[], result[], maxlength);
native db_get_field_assoc_int(DBResult:result, const field[]);
native Float:db_get_field_assoc_float(DBResult:result, const field[]);
Reply
#4

ohh thanks, i will test it, before test help me for solved this

Код:
COMMAND:clabel(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
		new
			query[400],
			Float:x,
			Float:y,
			Float:z,
			text
		;

		GetPlayerPos(playerid, x, y, z);

		if(sscanf(params, "s[30]", text))
		{
			SendClientMessage(playerid, 0xFFFFFFFF, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"clabel <Text>\"");
		}
		else
		{
			format(query, sizeof(query), "INSERT INTO `Label` (Label_Text, Label_X, Label_Y, Label_Z) VALUES ('%s', '%f', '%f', '%f')", text, x, y, z);
			db_query(DB: LabelDB, query);
			
			reloadLabels();
		}
	}
	else
	{
		SendClientMessage(playerid, 0xFFFFFFFF, "{B7B7B7}[SERVER] {FFFFFF}You do not have permission to use that command.");
	}

	return 1;
}
why all of coordinates (x,y,z) always set to 0.0000
Reply
#5

The text worked, thanks rep++ but help me for solved my code above
Reply
#6

sscanf is unable to verify if the given variables matches the specified pattern
I think in your case it simply overwrote up to 29 cells before "text" in the stack because you declared "text" with only 1 cell
Код:
new
	query[400],
	Float:x,
	Float:y,
	Float:z,
	text // you forgot to add [30] here => text[30]
;
Reply
#7

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
sscanf is unable to verify if the given variables matches the specified pattern
I think in your case it simply overwrote up to 29 cells before "text" in the stack because you declared "text" with only 1 cell
Код:
new
	query[400],
	Float:x,
	Float:y,
	Float:z,
	text // you forgot to add [30] here => text[30]
;
oh man, i'm forgot about it xD ty so much , big rep for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)