Syntax in database
#1

Hello guys, after enter my value, he not convert in text in my database, how to fix please ?

my script: https://pastebin.com/nvNGSiNg


screenshot of dabatase result: http://prntscr.com/hr1xu8
Reply
#2

What is villenaissance field's type? Is it string? then you don't have to use strval and convert it to integer.And use single quotes ('%q' for standard format) if it is string.If it is integer use %d
Reply
#3

"%e" is not supported by standard "format", use "mysql_format". Also, strings must be enclosed in quotes, i.e "field_value = '%e'"
Reply
#4

Quote:

mysql_format(dbhandle, query, sizeof(query), "UPDATE `server_fiches` SET couleur_yeux='%e' WHERE player_id = %d", coloryeux, PlayerInfo[playerid][p_ID]);
mysql_tquery(dbhandle, query, "SendQuery", "");


Quote:

case DIALOG_FICHE_COLOR_YEUX:
{
new coloryeux = strval(inputtext);
new query[700];

if(!response)
return 0;


SendClientMessageF(playerid, COLOR_LIGHTBLUE, "Bien vos yeux sont de couleur: %s", inputtext);

ShowPlayerDialog(playerid, DIALOG_FICHE_TAILLE, DIALOG_STYLE_INPUT, "Crйation de votre fiche", "Entrez la taille de votre personnage:", "Valider", "Quitter");

//format(query, sizeof(query), "UPDATE `server_fiches` SET couleur_yeux=%e WHERE player_id=%d", coloryeux, PlayerInfo[playerid][p_ID]);
//mysql_tquery(dbhandle, query, "SendQuery", "");

//mysql_format(dbhandle, query, sizeof(query), "UPDATE `server_fiches` (couleur_yeux) VALUES ('%e')", coloryeux, PlayerInfo[playerid][p_ID]);
//mysql_tquery(dbhandle, query, "SendQuery", "");

mysql_format(dbhandle, query, sizeof(query), "UPDATE `server_fiches` SET couleur_yeux='%e' WHERE player_id = %d", coloryeux, PlayerInfo[playerid][p_ID]);
mysql_tquery(dbhandle, query, "SendQuery", "");

}

I have try with this, and again not convert


Screenshot of database : http://prntscr.com/hr2dow
Reply
#5

Your code makes no sence. :/
"couloryeux" (wich mean eyes's color) seems to be an integer first "new coloryeux = strval(inputtext);" and after that, you try to update a string with an interger.
Also:
SendClientMessageF(playerid, COLOR_LIGHTBLUE, "Bien vos yeux sont de couleur: %s", inputtext);
mean the player have entered a color like Blue, Green, Grey, or whatever and not an interger.

Either you store the eyes's color as a string or an interger, not both of them at the same time.
Reply
#6

Yeah I have understand, thanks, fixed !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)