[Server] MYSQL R41-4 - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Support (https://forum.open.mp/forumdisplay.php?fid=12) --- Thread: [Server] MYSQL R41-4 (/showthread.php?tid=1959) |
MYSQL R41-4 - israel_Oliveira - 2021-04-28 Good afternoon, I am using the mysql plugin and I have this problem. [color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif] Code: [/font][/size][/color] My server and linux and I'm using another windows vps with xampp to use the database I've managed to make the connection but I can't add or consult anything in the database Can someone help me? RE: MYSQL R41-4 - Chessy - 2021-04-28 To see where those errors are coming from you have to put at the top of the OnGamemodeInit callback the function "mysql_log(ALL);" so in logs > mysql > mysql.log you can see what query it was And i recommend you to see the github code breaker mysql thing in the page of it. RE: MYSQL R41-4 - israel_Oliveira - 2021-04-28 I changed to R41-3 [04/28/21 14:36:15] [DEBUG] CConnection::CConnection(this=0xec67c008, host='IP', user='USER', passw='PASS', db='logs_servidor', options=0x97ede98) [04/28/21 14:36:15] [DEBUG] CConnection::CConnection - new connection = 0x9888af8 [04/28/21 14:36:15] [DEBUG] CThreadedConnection::CThreadedConnection(this=0xec67c008, connection=0xec67c008) [04/28/21 14:36:15] [DEBUG] CThreadedConnection::WorkerFunc(this=0xec67c008, connection=0xec67c008) [04/28/21 14:36:15] [INFO] Connection handle with id '1' successfully created. [04/28/21 14:36:15] [DEBUG] CHandleManager::Create - new handle = 0x97a2758 [04/28/21 14:36:15] [DEBUG] mysql_connect: return value: '1' [04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0' [04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty [04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0' [04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty [04/28/21 14:42:29] [ERROR] error #1064 while executing query "er Logs:{ffffff} ComandoLog ": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'er Logs:{ffffff} ComandoLog' at line 1 I am not able to find the error, only that the version of mysql server is different RE: MYSQL R41-4 - RhaegarX - 2021-04-30 on localhost on the linux vps itself the code works normally? RE: MYSQL R41-4 - Chessy - 2021-04-30 (2021-04-28, 05:47 PM)israel_Oliveira Wrote: I changed to R41-3 [04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0' It says that you are using a wrong connection handle in your MySQL Format. You are using something like mysql_format(0, query, sizeof(query), "INSERT INTO..." instead of mysql_format(Dtabase, query, sizeof(query), "INSERT INTO..." And how you define Database? Well, using it in the mysql_connect at the OnGamemodeInit. new MySQL: Database; // This is going at the start of the gamemode. new MySQLOpt: option_id = mysql_init_options(); // This, in GamemodeInit as the two below this one. mysql_set_option(option_id, AUTO_RECONNECT, true); // We will set that option to automatically reconnect on timeouts. Database = mysql_connect(IP_SQL, USER_SQL, PASSWORD_SQL, DATABASE_SQL, option_id); RE: MYSQL R41-4 - israel_Oliveira - 2021-04-30 Thanks to everyone, I had already solved the problem but I ended up not commenting here, it was a simple syntax error RE: MYSQL R41-4 - Kwarde - 2021-05-21 (2021-04-30, 04:59 PM)israel_Oliveira Wrote: Thanks to everyone, I had already solved the problem but I ended up not commenting here, it was a simple syntax error There was indeed a syntax error in the logs. However: Quote:[04/28/21 14:36:15] [INFO] Connection handle with id '1' successfully created. A connection with id 1 was created (as literally stated in the logs). But then there's this log: Quote:[04/28/21 11:14:16] [ERROR] mysql_format: invalid connection handle '0' That has nothing to do with a syntax error. When you create a variable without a value, it's initial value will be 0. It is quite possible you used a wrong variable or created a new one (or the value of the variable with the MySQL connection ID was set to 0) for the connection handle: Code: //Global variable: |