SA-MP Forums Archive
MySQL issue - 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 issue (/showthread.php?tid=654499)



MySQL issue - Scofield11 - 30.05.2018

Hey guys, I've been recently looking forward to use a pre-scripted gamemode that uses MySQL, I have managed to edit bunch of things and fix some of the errors but I'm still experiencing an issue when registering a new account.

So basically at first it used to give me these two errors, but I fixed them:
Код:
[08:11:37 05/30/18] [ERROR] CMySQLQuery::Execute[] - (error #1060) Duplicate column name 'SpawnPos' (Query: "ALTER TABLE `players` ADD `SpawnPos` INT NOT NULL DEFAULT '0';")
[08:11:37 05/30/18] [ERROR] CMySQLQuery::Execute[] - (error #1060) Duplicate column name 'LogUnix' (Query: "ALTER TABLE `players` ADD `LogUnix` INT NOT NULL DEFAULT '0';")
[08:11:37 05/30/18] [ERROR] CMySQLQuery::Execute[] - (error #1060) Duplicate column name 'HelperReports' (Query: "ALTER TABLE `players` ADD `HelperReports` INT NOT NULL DEFAULT '0';")
[08:11:37 05/30/18] [ERROR] CMySQLQuery::Execute[] - (error #1060) Duplicate column name 'family' (Query: "ALTER TABLE `vehicles` ADD `family` INT(2) NOT NULL DEFAULT 0;")
[08:11:37 05/30/18] [ERROR] CMySQLQuery::Execute[] - (error #1060) Duplicate column name 'lockfeature' (Query: "ALTER TABLE `vehicles` ADD `lockfeature` INT(2) NOT NULL DEFAULT 0;")
Everytime it gave me one of these errors, but I got them fixed.
Код:
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT HouseID FROM houses ORDER BY HouseID DESC LIMIT 1;")
[ERROR] cache_get_field_content_int - invalid datatype
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT * FROM `stuff`")
[ERROR] cache_get_field_content_int - invalid datatype
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT HouseID FROM houses ORDER BY HouseID DESC LIMIT 1;")
[ERROR] cache_get_field_content_int - invalid datatype
[WARNING] CMySQLHandle::DeleteSavedResult - invalid result id ('0')
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT * FROM `stuff`")
[ERROR] cache_get_field_content_int - invalid datatype
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT HouseID FROM houses ORDER BY HouseID DESC LIMIT 1;")
[ERROR] cache_get_field_content_int - invalid datatype
[WARNING] CMySQLHandle::DeleteSavedResult - invalid result id ('1')
[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT `versionstr` FROM `stuff`")
But, now whenever I try to create a new account, I type the password then the server crashes and I have to restart it again. But the account then is successfully registered into the database. I'm pretty sure there's something wrong with the 'houses' table but I'm unable to locate the error, so please help me to do so.

Here's the .sql file: https://pastebin.com/xFPTbXSy
Here's the (loading owned/unowned houses): https://pastebin.com/00F1X7M2
Here's the server_log:
Код:
[08:50:10] [connection] incoming connection: 127.0.0.1:51133 id: 0
[08:50:10] [join] Hello_World has joined the server (0:127.0.0.1)
[08:50:15] mysql_tquery OnPlayerRequestClass
[08:50:23] mysql_tquery OnPlayerRegister
[08:50:23] Account created for Hello_World
[08:50:23] [MySQL] SQLSave(start) Hello_World.
[08:50:23] [MySQL] SQLSave(end) Hello_World.
[08:50:23] mysql_tquery SetPlayerID
Thank you <3


Re: MySQL issue - GTLS - 30.05.2018

First Errors came, because you already had those columns in your DB but you still tried to add them.

Second errors came because Query is set to give output even if there are no houses in table.

add,
PHP код:
 if(cache_num_rows()) 
before loading to make sure it loads only if rows are there else, not.

Also, Rows start from 0 index and your for loop in Loading houses starts from 1.

PHP код:
 for(new id 1id cache_num_rows(); id++) 
Set it to,
PHP код:
 for(new id 0id cache_num_rows(); id++) 



Re: MySQL issue - Scofield11 - 30.05.2018

I did what you said but the crash still remains, and I'm getting now this error instead.

Код:
[09:40:51 05/30/18] [WARNING] cache_get_row_count - no active cache



Re: MySQL issue - GTLS - 30.05.2018

Cache is not active means, the mysql_tquery was not initiated to create a cache memory. Put Debugging statement like, print("Cache Created"); inside MySQL Threaded function to see if it gets called or not.


Re: MySQL issue - Scofield11 - 31.05.2018

I had an issue with the 'ID' collumn and I fixed it, but I'm still experiencing the crash. Do you have any idea how can I get this error fixed?

Код:
[00:58:19 05/31/18] [WARNING] cache_get_row_count - no active cache



Re: MySQL issue - GTLS - 31.05.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Cache is not active means, the mysql_tquery was not initiated to create a cache memory. Put Debugging statement like, print("Cache Created"); inside MySQL Threaded function to see if it gets called or not.
By Doing this.