SA-MP Forums Archive
MySQL storing strings - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL storing strings (/showthread.php?tid=613003)



MySQL storing strings - Ahmed21 - 23.07.2016

Hello everyone, so I've made a notes system.. and in the notes table, I added "NoteText".
I store the "NoteText" in a variable, but the variable returns "NULL", not the text of the note.

Here's the code:
PHP код:
forward ViewNotesFunc(playerid);
public 
ViewNotesFunc(playerid)
{
    new
        
rows,
        
fields;
    
cache_get_data(rows, fields, mysql);
    
    if(
rows)
    {
        new 
string[128], vipnote, noteid, notetext[30];
        for(new 
i = 0; i < rows; i++)
        {
            
noteid = cache_get_row_int(i, 0);
            
cache_get_row(i, 4, notetext);
            
vipnote = cache_get_row_int(i, 3);
            
format(string, sizeof(string), "Note ID: %d || VIP Note: %d || Note text: %s", noteid, vipnote, notetext);
            
SendServerMSG(playerid, string);
        }
    }
    else
    {
        
SendErrorMSG(playerid, "This player doesn't have any note.");
    }
    return 
1;
}