Mysql and dialogs -
Urefeu - 21.09.2011
Hello.
I have two problems.
The first is for dialogue, here InputText.
I do a if (response) { Do This } else { Do That }
The problem is that even if nothing is entered in the input field, response is still to true (since I press the first button).
I then try to test whether InputText was empty, but I can not do these tests without getting an error: /
Second problem with mysql.
I do for example:
Код:
format(query, 400, "INSERT INTO `members`(pseudo, password, ip, register_date, last_connection_date, last_connection_ip) VALUES('%s', '%s', '%s', '%s', '%s', '%s')", pPseudo, password, p[playerid][ip], date, date, p[playerid][ip]);
mysql_query(query);
All variables are defined and I have no error but nothing is inserted into the DB then you see the validation message to the next line ...
I tried to do a query of SendClientMessage, but nothing appears ... String too long? Yet if I put query [1000], it does not work more: /
Thank you!
Re: Mysql and dialogs -
[MWR]Blood - 21.09.2011
About the MySQL... enable the debug and show what is it telling.
About the dialogs, show the code!
Re: Mysql and dialogs -
aRoach - 21.09.2011
pawn Код:
format( query, 400, "INSERT INTO `members`( `pseudo`, `password`, `ip`, `register_date`, `last_connection_date`, `last_connection_ip` ) VALUES( '%s', '%s', '%s', '%s', '%s', '%s' )", pPseudo, password, p[ playerid ][ ip ], date, date, p[ playerid ][ ip ] );
mysql_query( query );
Post the Dialog Code....
Re: Mysql and dialogs -
Urefeu - 21.09.2011
OnQueryError
Код:
public OnQueryError(errorid, error[], resultid, extraid, callback[], requete[], connectionHandle)
{
switch(errorid)
{
case CR_COMMAND_OUT_OF_SYNC:
{
printf("Commands out of sync for thread ID: %d",resultid);
}
case ER_SYNTAX_ERROR:
{
printf("Something is wrong in your syntax, query: %s",query);
}
}
return 1;
}
gives me no error.
For dialogue, it's just a InputText is displayed, and I do not know how to check that is indeed inserted something ...
Re: Mysql and dialogs -
Vince - 21.09.2011
Quote:
Originally Posted by Urefeu
OnQueryError
gives me no error.
|
Because the error might not be a syntax error nor a commands out of sync error ... Try this instead:
pawn Код:
public OnQueryError(errorid, error[], resultid, extraid, callback[], requete[], connectionHandle)
{
printf("[sql] MySQL Error #%d: %s", errorid, error);
return 1;
}
Quote:
Originally Posted by Urefeu
For dialogue, it's just a InputText is displayed, and I do not know how to check that is indeed inserted something ...
|
Use
isnull(inputtext) or
!strlen(inputtext).
Re: Mysql and dialogs -
Urefeu - 21.09.2011
It works for dialogs, thank you!
But my query does not work, and I have no error: /
Re: Mysql and dialogs -
Urefeu - 21.09.2011
I've this code :
Код:
GetPlayerName(playerid, strings[0], 50);
format(query, 600, "SELECT * FROM `members` WHERE pseudo = '%s'", strings[0]);
SendClientMessageToAll(ORANGE, query);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
SendClientMessageToAll(ORANGE, rows);
I can see : SELECT * FROM `members` WHERE pseudo = 'Mypseudo'
But I havn't see the numbers of rows :/
Re: Mysql and dialogs -
Urefeu - 22.09.2011
Up please !