mysql question
#1

hi,

ive added a mysql field to all columns (user accounts) in my database after theese user accounts have been created (inserted into).

So this field that ive added later now is empty but it exists.
So can i treat this field with the UPDATE command now or not?
Cause right now all other fields are updated but the only field that has been added later isnt updated.

thx.
Reply
#2

I don't understand the question. Can you show a screenshot of your mySQL table structure including the new field?
Reply
#3

yes, you need to use the UPDATE clause from now on. INSERT is only used when the row is being inserted for the first time, updating the existing row requires UPDATE.
Reply
#4

mhhh, i have a mysql database for all players.
Every players account (=table) has about 20 fields (for saving money,score, last position etc.).
A lot of player accounts already exists.
But today i wanted to add a new field to all accounts.
That means there wouldnt be 20 fields per account anymore but 21 right?
So now my question just is, can i just handle this new field like all others? (saving data into it using UPDATE in the mysql query?)
Cause i didnt insert into it, i just added it using php my admin.
And for some reason i cant save data into it (no errors in the log thought.)

I hope its understandable better now
Reply
#5

sorry for double post but maybe the prob is here:

on disconnect i want to save the players ip in the specific account field.
But the field where the ip is supposed to be savved stays empty or it saves the ip 255.255.255.255. (wrong IP)
So what is wrong with this part of code:

pawn Код:
new query[128], pname[24], IPs[16];
        GetPlayerName(playerid, pname, 24);
        GetPlayerIp(playerid,IPs,16);
        format(query, sizeof(query), "UPDATE accounts SET IP='%s' WHERE name='%s'",IPs,pname);
        mysql_query(query);
Reply
#6

Check the mySQL log.
Reply
#7

already checked, no errors, warnings etc...
mhhh, pretty confusing.
Reply
#8

solved!
the problem wasnt my code but the fact that ive used the getip function in the OnPlayerDisconnect Callback.
I moved this whole code to the OnPlayerConnect callback and it just works fine!
Seems to be a samp bug as the ip that is saved to a variable/string isnt saved correctly while the player is disconnecting.
thx all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)