SA-MP Forums Archive
Query error - 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: Query error (/showthread.php?tid=618749)



Query error - Mo123 - 09.10.2016

How am I supposed to solve these errors

OnQueryError: errorid: 1060, error: Duplicate column name 'SpawnPos', callback: , query: ALTER TABLE `players` ADD `SpawnPos` INT NOT NULL DEFAULT '0';, connectionHandle: 1
[15:48:22] OnQueryError: errorid: 1060, error: Duplicate column name 'LogUnix', callback: , query: ALTER TABLE `players` ADD `LogUnix` INT NOT NULL DEFAULT '0';, connectionHandle: 1
[15:48:22] OnQueryError: errorid: 1060, error: Duplicate column name 'HelperReports', callback: , query: ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';, connectionHandle: 1
[15:48:22] OnQueryError: errorid: 1060, error: Duplicate column name 'family', callback: , query: ALTER TABLE `vehicles` ADD `family` INT(2) NOT NULL DEFAULT 0;, connectionHandle: 1
[15:48:22] OnQueryError: errorid: 1060, error: Duplicate column name 'lockfeature', callback: , query: ALTER TABLE `vehicles` ADD `lockfeature` INT(2) NOT NULL DEFAULT 0;, connectionHandle: 1


Re: Query error - ChristolisTV - 09.10.2016

Can you show us code? We can help you better.


Re: Query error - azzerking - 09.10.2016

Your trying to add columns to your database table that already exist, you can't add a column if it already exists.

comment out those functions, until you move server or need to start fresh on a database.


Re: Query error - Mo123 - 09.10.2016

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Your trying to add columns to your database table that already exist, you can't add a column if it already exists.

comment out those functions, until you move server or need to start fresh on a database.
I transferred my files to the host, uploaded the sql file and it went fine. I don't get why I still get those errors


Re: Query error - azzerking - 09.10.2016

Listen to what I am saying.

The columns already exist, and your trying to create them again, but mysql will error and say that they already.

You can't create something that already exists.

Find the line of where these queries are being called and comment them out. You only ever need to run this queries once, when you start fresh or like you said have moved.


Re: Query error - Mo123 - 09.10.2016

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Listen to what I am saying.

The columns already exist, and your trying to create them again, but mysql will error and say that they already.

You can't create something that already exists.

Find the line of where these queries are being called and comment them out. You only ever need to run this queries once, when you start fresh or like you said have moved.
OnQueryError: errorid: 1060, error: Duplicate column name 'LogUnix', callback: , query: ALTER TABLE `players` ADD `LogUnix` INT NOT NULL DEFAULT '0';, connectionHandle: 1


17413 > PlayerInfo[playerid][pLastLogoutUnix] = cache_get_field_content_int(0, "LogUnix");

24441 > mysql_format(sqlGameConnection, query, sizeof(query), "%s`HelperReports` = %d, `SpawnPos` = %d, `LogUnix` = %d",

92191 > mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `LogUnix` INT NOT NULL DEFAULT '0';");

//


OnQueryError: errorid: 1060, error: Duplicate column name 'HelperReports', callback: , query: ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';, connectionHandle: 1


24442 > mysql_format(sqlGameConnection, query, sizeof(query), "%s`HelperReports` = %d, `SpawnPos` = %d, `LogUnix` = %d",
query, PlayerInfo[playerid][pHelperReports], PlayerInfo[playerid][pSpawnPos], PlayerInfo[playerid][pLastLogoutUnix]);


33084 > mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `Name`, `LastLogin`, `HelperReports` FROM `players` WHERE `Adjustable`=1 AND `HelperLevel` > 0");

92193 > mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';");


Re: Query error - azzerking - 09.10.2016

Find this in your gamemode:

Код:
mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';");
and change it to
Код:
/*mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';");*/



Re: Query error - Mo123 - 09.10.2016

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Find this in your gamemode:

Код:
mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';");
and change it to
Код:
/*mysql_tquery(sqlGameConnection, "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';");*/
Worked. Should I do the same with the others?


Re: Query error - azzerking - 09.10.2016

Yes, if you ever move to a new server, then remember to uncomment them and run them just once. After they are run you may comment them out again.


Re: Query error - Mo123 - 09.10.2016

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Yes, if you ever move to a new server, then remember to uncomment them and run them just once. After they are run you may comment them out again.
Yeah, it worked.

I was just wondering if you can solve this "MySQL can't connect to localhost".

So I have a free SAMP host at frag. I made a mysql database and imported the sql file. I edited mysql_log.txt and mysqlconfig.inc with the correct name, pass and database, but it still dosen't let the mysql connect to the database. It works pefectly fine when I use phpmyadmin through xampp. Any solutions to this?