Query error
#1

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
Reply
#2

Can you show us code? We can help you better.
Reply
#3

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.
Reply
#4

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
Reply
#5

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.
Reply
#6

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';");
Reply
#7

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';");*/
Reply
#8

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?
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)