[MySQL] phpMyAdmin
#1

Hello, this text shows for me in phpMyAdmin:

Код:
Server running with Suhosin. Please refer to documentation for possible issues.
Furthermore my server shutting down when you try to register.. What can I do?!
Reply
#2

Does the sa-mp server successfully connect with the database?
Have you added the right tables and columns?
Reply
#3

Yes, successfully, maybe I need to use:

Код:
mysql_fetch_field_row
Cuz I don't use at now..
Reply
#4

Код:
mysql_fetch_field_row
You don't need that for an insert query.

Could you post the code you are using to register?

Example of an insert query:
Код:
new query[256];
format(query, sizeof(query), "insert into user(username,password) values('%s','%s');",username,password);
mysql_query(query);
Reply
#5

pawn Код:
new string[128];
            format(string, sizeof(string), "INSERT INTO Users (Name,Password) VALUES ('%s','%s')", UserStats[playerid][Name], inputtext);
            mysql_query(string);
Reply
#6

Код:
INSERT INTO Users (Name,Password) VALUES ('test','password')
Run this code in phpMyAdmin and see if you get an error. If you get one, you should check your database structure.
Reply
#7

Where can I run this code? In "SQL" paragraph?
Reply
#8

If so then:

Код:
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0026 sec)
Furthermore everything is OK with a password and name, these columns are saving, but doesn't save the other..
Reply
#9

I found the problem, in fact when you register, you're automatically logged in. So when you logged in, my server shutting down. Here is the code:

pawn Код:
LoginPlayer(playerid, password[])
{
    if(!AccountExists[playerid])
        return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're not registered!");

    if(PlayerLogged[playerid])
            return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] You're already logged in!");

    if(strlen(password) < 3 || strlen(password) >= 32)
            return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Your password is too short or too long!");

    CheckMySQL();

        new string[128];
    format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s' AND Password = '%s'", UserStats[playerid][Name], password);
    mysql_query(string);
    mysql_store_result();

    if(!mysql_num_rows())
        return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Incorrect password!");

    new row[128]; // The length of 1 'row' total.
    new field[5][32]; // [4] = Amount of fields, [24] = Max length of the bigest field.

    mysql_fetch_row_format(row, "|");
    explode(row, field, "|");
    mysql_free_result();

    // The field starts here with 1, because the field 'Name' = 0, and we already have the name in a variable.
    format(UserStats[playerid][Password], 32, "%s", field[1]);
    UserStats[playerid][Admin] = strval(field[2]);
    UserStats[playerid][Money] = strval(field[3]);
    UserStats[playerid][Adresas] = strval(field[4]);

    GivePlayerMoney(playerid, UserStats[playerid][Money]);
    GetPlayerIp(playerid, UserStats[playerid][Adresas]);

        PlayerLogged[playerid] = 1;
        return 1;
}
Reply
#10

Quote:
Originally Posted by V4at
Посмотреть сообщение
pawn Код:
explode(row, field, "|");
The explode function should be used like this:
Код:
explode(string[],delim[],result[][],maxsplit=0);
In your case:

Код:
explode(row, "|", field);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)