MySQL problem
#1

Hello guys today i have decided to work on MySQL so i have start to convert my saving system to MySQL but i got some problems with saving i have created a table users and when i try to add more then 5 columns then data not getting saved i am confused please help me.

this code working perfectly and saving data

PHP код:
format(query2 ,sizeof(query2), "INSERT INTO `users` (PN, PS, SC, MN, DT) VALUES ('%s', 'abc', %d, %d, %d)",
playernameGetPlayerScore(playerid), GetPlayerMoney(playerid), deaths[playerid]);
mysql_query(mysqlquery2); 
if i add 1 more column then its not getting saved.

table structure

Reply
#2

it can be your query2 size try increasing it then adding another column.
Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
it can be your query2 size try increasing it then adding another column.
Thanks you man solved my problem

+REP
Reply
#4

If you're updating values that are already in the database, you just use..

Just an example

PHP код:
new query2[200];
mysql_format(mysqlquery2 sizeof(query2), "UPDATE `users` SET PS = 'abc', SC = '%d,' MN = '%d', DT = '%d' WHERE PN = '%e'"GetPlayerScore(playerid), GetPlayerMoney(playerid), deaths[playerid], playername); 
mysql_query(mysqlquery2); 
If you don't want to use mysql_format use %q for strings to escape them.

Though many would recommend saving with their database ID, instead of their usernames
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)