SA-MP Forums Archive
** [MySQL]: Unknown column 'Gold' in 'field list' - 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]: Unknown column 'Gold' in 'field list' (/showthread.php?tid=562223)



** [MySQL]: Unknown column 'Gold' in 'field list' - lulo356 - 07.02.2015

I dont understand this error, can you help me?

pawn Code:
format(query, sizeof(query), "UPDATE `characters` SET `Created` = '%d', `Gender` = '%d', `Birthdate` = '%s', `Origin` = '%s', `Skin` = '%d', `PosX` = '%.4f', `PosY` = '%.4f', `PosZ` = '%.4f', `PosA` = '%.4f', `Health` = '%.4f', `Interior` = '%d', `World` = '%d', `Hospital` = '%d', `HospitalInt` = '%d', `Money` = '%d', `Gold` = '%d', `BankMoney` = '%d', `OwnsBillboard` = '%d', `Savings` = '%d', `Admin` = '%d', `Helper` = '%d', `Moderator` = '%d', `JailTime` = '%d', `Muted` = '%d'",



Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - HazardouS - 07.02.2015

Well, it's pretty self explanatory. The 'Gold' field (column) is not recognized by your 'characters' table, so make sure that field exists.


Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - lulo356 - 07.02.2015

Okay, How can i create an new column for the gold?


Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - HazardouS - 07.02.2015

The string you are formatting there is a query. Where do queries go? To a SQL database. What is a SQL database made of? Tables. What are the main elements of a table? Fields. Are fields in the script? No, they are in a table. Are you sure that the field "Gold" really exists in your table? We don't know, but we hope to find out.


Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - Abagail - 07.02.2015

Using phpmyadmin, you can simply go to the table and in the structure panel page click "add a column to the table".

Additionally, you can use a SQL query to modify the data:
pawn Code:
ALTER TABLE `characters` ADD `Gold` INT NOT NULL ;



Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - lulo356 - 07.02.2015

Quote:
Originally Posted by HazardouS
View Post
The string you are formatting there is a query. Where do queries go? To a SQL database. What is a SQL database made of? Tables. What are the main elements of a table? Fields. Are fields in the script? No, they are in a table. Are you sure that the field "Gold" really exists in your table? We don't know, but we hope to find out.
I found out that there is no column from Gold in the SQL, how can i create an new column


Re: ** [MySQL]: Unknown column 'Gold' in 'field list' - HazardouS - 07.02.2015

Do what Abagail said above. Choose the method that's simpler for you.