suggestion check
#1

Hello, well i have a table in database name `suggestion`. Anyway, i wanna check who suggested but anytime when i try the command, it insets me a new row with my name and in suggestion nothing.

PHP код:
CMD:checksuggestion( playerid, params[] )
{
    new 
Query[700], name[24], suggestion[200], string[1000], aux[1000];
    
format(Query, sizeof(Query), "SELECT * FROM `suggestions`");
    
mysql_query(Query);
    
mysql_store_result();
    if(
mysql_num_rows() != 0)
    {
        while(
mysql_fetch_row(Query))
        {
            
mysql_fetch_field_row(name, "user");
            
mysql_fetch_field_row(suggestion, "suggestion");
            
format(aux, sizeof(aux), "{00FF00}User: {FFFFFF}%s\t\t{00FF00}Suggestion: {FFFFFF}%s\n", name, suggestion);
            
strcat(string, aux);
            
ShowPlayerDialog(playerid, 20, DIALOG_STYLE_MSGBOX, "{FFFFFF}Suggestion List", string, "Ok","");
        }
    }
    
mysql_free_result();
    return 
1;
} 
Reply
#2

bump
Reply
#3

Show the part where you store the suggestions (INSERT INTO ...)
Reply
#4

PHP код:
    if(dialogid == 20)
    {
        if(
response == 1)
        {
            new 
query[200];
            
GetPlayerName(playerid, pname, sizeof pname);
            
format(query, sizeof(query), "INSERT INTO `suggestions` (`user`, `suggestion`) VALUES ('%s','%s')",pname, inputtext);
            
mysql_query(query);
            
mysql_store_result();
        }
        
mysql_free_result();
    } 
Reply
#5

Print out the inputtext to see if it holds the suggestion. If It's the same as the text you entered in the dialog, then It's a problem with your database
Reply
#6

well i use almost the same technique on checkban and it works perfect.
Does anyone of you have another solution?
Reply
#7

I've found the problem, i forgot the check the number of the dialog on checksug, so everytime when i was checking i was added new row with empty name. Anyway thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)