Mysql help little problem
#1

this is my code so if he set his email he cant set again but if not set to set and i wont if posible min 5 charecter text if posible ty i get this error : error 029: invalid expression, assumed zero

pawn Код:
if( dialogid == DIALOG_EMAIL)
    {
        if(!response) return true;
        else
        {
            new set[100];
            format(set,sizeof(set),"SELECT `set` FROM `backup` WHERE `username` = '%s' AND `set` != 0 LIMIT 1",PlayerName(playerid));
            mysql_query(set);
            {
                //backup
                new email[100];
                format(email,sizeof(email),"INSERT INTO backup (username,email,IP,set) VALUES ('%s','%s','%s',1)",PlayerName(playerid),inputtext,GetPlayerIP(playerid));
                mysql_query(email);
                SendClientMessage(playerid,COLOR_MBLUE,"Your email adress have been set");
            }
            else
            {
               ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX,"\t"RED"ERROR","You have already set your email\nplease contact to admin for more support","OK","");
            }
        }
    }
Reply
#2

Use
pawn Код:
if(!strlen(inputtext) || strlen(inputtext) < 5)
Reply
#3

Quote:
Originally Posted by Fires
Посмотреть сообщение
Use
pawn Код:
if(!strlen(inputtext) || strlen(inputtext) < 5)
but how to make if player already set hes email he cant set it again ?
Reply
#4

can you show as error line ?
Reply
#5

pawn Код:
else //<<< here
            {
               ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX,"\t"RED"ERROR","You have already set your email\nplease contact to admin for more support","OK","");
            }
here please help me please
Reply
#6

pawn Код:
if( dialogid == DIALOG_EMAIL)
    {
        if(!response) return true;
        else
        {
            new set[100];
            format(set,sizeof(set),"SELECT `set` FROM `backup` WHERE `username` = '%s' AND `set` != 0 LIMIT 1",PlayerName(playerid));
            mysql_query(set);
            mysql_store_result();
            if(!mysql_num_rows())
            {
                //backup
                new email[100];
                format(email,sizeof(email),"INSERT INTO backup (username,email,IP,set) VALUES ('%s','%s','%s',1)",PlayerName(playerid),inputtext,GetPlayerIP(playerid));
                mysql_query(email);
                SendClientMessage(playerid,COLOR_MBLUE,"Your email adress have been set");
            }
            else
            {
               ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX,"\t"RED"ERROR","You have already set your email\nplease contact to admin for more support","OK","");
            }
        }
    }
Reply
#7

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
if( dialogid == DIALOG_EMAIL)
    {
        if(!response) return true;
        else
        {
            new set[100];
            format(set,sizeof(set),"SELECT `set` FROM `backup` WHERE `username` = '%s' AND `set` != 0 LIMIT 1",PlayerName(playerid));
            mysql_query(set);
            mysql_store_result();
            if(!mysql_num_rows())
            {
                //backup
                new email[100];
                format(email,sizeof(email),"INSERT INTO backup (username,email,IP,set) VALUES ('%s','%s','%s',1)",PlayerName(playerid),inputtext,GetPlayerIP(playerid));
                mysql_query(email);
                SendClientMessage(playerid,COLOR_MBLUE,"Your email adress have been set");
            }
            else
            {
               ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX,"\t"RED"ERROR","You have already set your email\nplease contact to admin for more support","OK","");
            }
        }
    }
its show error dialog to player but now it cant insert into db please help
Reply
#8

Change

pawn Код:
new email[100];
to

pawn Код:
new email[150];

If that doesn't work, then turn on debugging via mysql_debug(1); under OnGameModeInit and try it. Then post your debug.txt in the root folder.
Reply
#9

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Change

pawn Код:
new email[100];
to

pawn Код:
new email[150];

If that doesn't work, then turn on debugging via mysql_debug(1); under OnGameModeInit and try it. Then post your debug.txt in the root folder.
still dont working here debug text

Quote:

[17:47:48] CMySQLHandler::Query(INSERT INTO backup (username,email,IP,set) VALUES ('[BG]PREDATOR','dore95@abv.bg','10.220.200.12',1) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set) VALUES ('[BG]PREDATOR','dore95@abv.bg','10.220.200.12',1' at line 1)

[17:47:48] >> mysql_free_result( Connection handle: 1 )

[17:47:48] CMySQLHandler::FreeResult() - Result was successfully free'd.
Reply
#10

help please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)