[HELP] MySQL Registration Failure
#1

hey guys im back from playing certain games and wanted back to script. In those case i have a little bit problem that i can't even figure out how to solve this. Hope you guys know how to solve this mysql registration failure.

pawn Код:
public OnPlayerConnect ( playerid )
{
    new pName [ MAX_PLAYER_NAME ]  ;
    SetPVarInt ( playerid , "Logged" , 0 ) ;
    GetPlayerName ( playerid , pName , sizeof ( pName ) ) ;
    format ( Query , sizeof ( Query ) , "SELECT * FROM `data` WHERE `Name` = '%s'" , pName ) ;
    mysql_query ( Query ) ;
    mysql_store_result ( ) ;
    if ( mysql_num_rows ( ) == 1 )
    {
        format ( String , sizeof ( String ) , ""LIGHTGREEN"Enter your password to proceed" ) ;
        ShowPlayerDialog ( playerid , DIALOG_LOGIN , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
    }
    else if ( mysql_num_rows ( ) == 0 )
    {
        format ( String , sizeof ( String ) , ""LIGHTGREEN"Enter your password to register" ) ;
        ShowPlayerDialog ( playerid , DIALOG_REGISTER , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
    }
    mysql_free_result ( ) ;
    return 1 ;
}
pawn Код:
case DIALOG_REGISTER:
        {
            if ( response )
            {
                if ( strlen ( inputtext ) < 0 || strlen ( inputtext ) > 100 )
                {
                    format ( String , sizeof ( String ) , ""LIGHTGREEN"You dont not enter any string or you just exceeding limit of password" ) ;
                    ShowPlayerDialog ( playerid , DIALOG_REGISTER , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
                }
                else
                {
                    new pName [ MAX_PLAYER_NAME ] ;
                    GetPlayerName ( playerid , pName , sizeof ( pName ) ) ;
                    mysql_real_escape_string ( inputtext , inputtext ) ;
                    format ( Query , sizeof ( Query ) , "INSERT INTO `data` ( `Name` , `Level` , `Password` , `Kill` , `Death` , `Money` , `Score` ) VALUES( '%s' , 0 , '%s' , 0 , 0 , 10000 , 0 )" , pName , inputtext ) ;
                    mysql_query ( Query ) ;
                   
                    SetPVarInt ( playerid , "Level" , 0 ) ;
                    SetPVarInt ( playerid , "Kill" , 0 ) ;
                    SetPVarInt ( playerid , "Death" , 0 ) ;
                    GivePlayerMoney ( playerid , 10000 ) ;
                    SetPlayerScore ( playerid , 0 ) ;
                    SetPVarInt ( playerid , "Logged" , 1 ) ;
                }
            }
            return 1 ;
        }
those are the codes for registration on mysql database.
Reply
#2

pawn Код:
mysql_debug(1);
under OnGameModeInit and then post your mysql_log file that is in your server directory.
Reply
#3

Really? ive used that already

Код:
[11:31:48]  

[11:31:48] ---------------------------

[11:31:48] MySQL Debugging activated (12/31/11)

[11:31:48] ---------------------------

[11:31:48]  

[11:31:48] >> mysql_ping( Connection handle: 1 )

[11:31:48] CMySQLHandler::Ping() - Connection is still alive.

[11:32:12] >> mysql_query( Connection handle: 1 )

[11:32:12] CMySQLHandler::Query(SELECT * FROM `data` WHERE `Name` = '[Sir]MonKat') - Successfully executed.

[11:32:12] >> mysql_store_result( Connection handle: 1 )

[11:32:12] CMySQLHandler::StoreResult() - Result was stored.

[11:32:12] >> mysql_num_rows( Connection handle: 1 )

[11:32:12] CMySQLHandler::NumRows() - Returned 0 row(s)

[11:32:12] >> mysql_num_rows( Connection handle: 1 )

[11:32:12] CMySQLHandler::NumRows() - Returned 0 row(s)

[11:32:12] >> mysql_free_result( Connection handle: 1 )

[11:32:12] CMySQLHandler::FreeResult() - Result was successfully free'd.
Reply
#4

That log shows nothing other than your login feature works.

Try using your register feature and show us the log for the register system.
Reply
#5

FOR CRYING OUT LOUD. THATS THE LOG! IDK WHICH LOG THAT SHOW REGISTER LOG. IN IN-GAME IT ALWAYS SHOWS UP THE FREAKING REGISTER DOWNLOAD OVER AND OVER AGAIN AS I CONNECT TO THE SERVER. THEN I CHECK IN THE FREAKING MYSQL LOCALHOST THAT HAD DATA ON IT AND CHECK THE INDEX. AND THE INDEX ARE NOT DEFINE AT ALL. DID I MAKE MY SELF CLEAR?
Reply
#6

Yes, correct - that is your mysql log. But it doesn't include anything to do with the register feature??

The mysql_log will show the register log, if any queries are actually called..

What shows up the freaking register download, over and over again? <-- Makes no sense to me at all.

And no, you didn't make yourself clear. How about you stop with your raging when i'm only trying to help you.
Reply
#7

Quote:
Originally Posted by GamingTurf
Посмотреть сообщение
What shows up the freaking register download, over and over again? <-- Makes no sense to me at all.
i meant is "whats shows up the freaking register dialog over and over again as i join the server.. so mysql doesnt register me at all"

and the log doesnt shows anything about registering to data to me..
Reply
#8

no one got idea to solve mysterious problem.. well that pretty weird
Reply
#9

Use rather
Код:
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}
and to query
Код:
... WHERE `Name` = '%s' LIMIT 1;
if this doesn't help, the problem is in your register query, causing some kind of error.
Your log didn't cover the register query.
Reply
#10

Quote:
Originally Posted by Johnson_boy
Посмотреть сообщение
Use rather
Код:
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}
and to query
Код:
... WHERE `Name` = '%s' LIMIT 1;
if this doesn't help, the problem is in your register query, causing some kind of error.
Your log didn't cover the register query.
with it or without it is the same still doesnt work.. the thing is weird.. i dont type the password and i press submit button.. it doesnt effect anything. it spose to be out of dialog that said wrong password but it dint out.. so it must be dialog bug..
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)