MySQL problem.
#1

Hi!

I've got a little problem with MySQL.
When I start my server on Windows, it all works fine. I've got the R6 MySQL plugin. (On Windows, it says, that it's R5) But on Linux host, when I log in, the server crashes.

Here's the OnPlayerLogin code:
Код:
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
	MySQLCheckConnection();
	new tmp2[256];
    new string2[64];
	new str[128];
	new
	string[256]
	;
	new playername2[MAX_PLAYER_NAME];
	new playernamesplit[3][MAX_PLAYER_NAME];
    GetRPName(playerid, playername2, sizeof(playername2));
	split(playername2, playernamesplit, '_');
	MySQLFetchAcctSingle(KasutajaInfo[playerid][pSQLID], "Password", KasutajaInfo[playerid][pKey]);
	if(!strcmp(KasutajaInfo[playerid][pKey],password, true ) )
	{
		new Query[1024];
		new Field[64];
		format(Query, sizeof(Query), "SELECT * FROM `players` WHERE `id` = '%d'", KasutajaInfo[playerid][pSQLID] );
        mysql_query(Query);
		mysql_store_result();
		if(mysql_fetch_row_format(Query,"|"))
		{
		    mysql_fetch_field_row(Field,"PlayerLevel"); KasutajaInfo[playerid][pLevel] = strval(Field);
			mysql_fetch_field_row(Field,"AdminLevel"); KasutajaInfo[playerid][pAdmin] = strval(Field);
                        //A Couple of more lines.
Windows server log:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[16:31:12] 
[16:31:12] Server Plugins
[16:31:12] --------------
[16:31:12]  Loading plugin: mysql
[16:31:13] 

  > MySQL plugin R5 successfully loaded.

[16:31:13]   Loaded.
[16:31:13]  Loading plugin: sscanf
[16:31:13] 

[16:31:13]  ===============================

[16:31:13]       sscanf plugin loaded.     

[16:31:13]    © 2009 Alex "******" Cole

[16:31:13]    0.3d-R2 500 Players "dnee"

[16:31:13]  ===============================

[16:31:13]   Loaded.
[16:31:13]  Loading plugin: streamer
[16:31:14] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[16:31:14]   Loaded.
[16:31:14]  Loading plugin: nativechecker
[16:31:14]   Loaded.
[16:31:14]  Loaded 4 plugins.

[16:31:14] 
[16:31:14] Ban list
[16:31:14] --------
[16:31:14]  Loaded: samp.ban
[16:31:14] 
[16:31:14] 
[16:31:14] Filterscripts
[16:31:14] ---------------
[16:31:14]   Loading filterscript 'Kiirusehoidja.amx'...
[16:31:14]   Loaded 1 filterscripts.

[20:21:24] MYSQL: Connecting...
[20:21:24] MYSQL: Connected.
[16:31:14] Gameode - On
[20:38:28]  _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[16:32:05]  
[16:32:05] Server's GM v1.0
[16:32:05]  _____________________________
[16:32:05]  
[16:32:05] Number of vehicle models: 103
[16:32:18] Incoming connection: 192.168.1.64:51120
[16:32:19] [join] Scripter_Scripter has joined the server (0:192.168.1.64)
[16:32:53] Scripter_Scripter has logged in.
[16:33:37] Scripter_Scripter has left the server (Disconnected).
[16:33:37] [part] Scripter_Scripter has left the server (0:1)
Linux server log:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e, ©2005-2012 SA-MP Team

[20:21:24] filterscripts = ""  (string)
[20:21:24] 
[20:21:24] Server Plugins
[20:21:24] --------------
[20:21:24]  Loading plugin: mysql.so
[20:21:24] 

  > MySQL plugin R6 successfully loaded.

[20:21:24]   Loaded.
[20:21:24]  Loading plugin: sscanf.so
[20:21:24] 

[20:21:24]  ===============================

[20:21:24]       sscanf plugin loaded.     

[20:21:24]    © 2009 Alex "******" Cole

[20:21:24]    0.3d-R2 500 Players "dnee"

[20:21:24]  ===============================

[20:21:24]   Loaded.
[20:21:24]  Loaded 2 plugins.

[20:21:24] 
[20:21:24] Ban list
[20:21:24] --------
[20:21:24]  Loaded: samp.ban
[20:21:24] 
[20:21:24] 
[20:21:24] Filterscripts
[20:21:24] ---------------
[20:21:24]   Loaded 0 filterscripts.

[20:21:24] MYSQL: Connecting...
[20:21:24] MYSQL: Connected.
[16:31:14] Gameode - On
[20:38:28]  _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28]  _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29]  _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[16:32:05]  
[16:32:05] Server's GM v1.0
[16:32:05]  _____________________________
[20:21:27]  
[20:21:27] Number of vehicle models: 103
[20:22:00] Incoming connection: 90.190.220.124:56523
[20:22:00] [join] Scripter_Scripter has joined the server (0:90.190.220.124)
//This is the part, where I log in and the server crashes.
Reply
#2

Enable mysql_debug in your script, then post the output in debug.txt.

pawn Код:
mysql_debug(1); //Ideally, inside OnGameModeInit
Reply
#3

Here's the output:
Код:
[20:55:27]  
[20:55:27] ---------------------------
[20:55:27] MySQL Debugging activated (11/02/12)
[20:55:27] ---------------------------
[20:55:27]
//Couple of "Successfully executed." lines
//And here's the problem lines
[20:56:49] CMySQLHandler::Query(SELECT Password FROM players WHERE id = 1 LIMIT 1) - Successfully executed.
[20:56:49] >> mysql_store_result( Connection handle: 1 )
[20:56:49] CMySQLHandler::StoreResult() - Result was stored.
[20:56:49] >> mysql_fetch_row_format( Connection handle: 1 )
[20:56:49] CMySQLHandler::FetchRow() - Return: mypassword
[20:56:49] >> mysql_query( Connection handle: 1 )
[20:56:49] CMySQLHandler::Query(SELECT * FROM `players` WHERE `id` = '1') - Successfully executed.
[20:56:49] >> mysql_store_result( Connection handle: 1 )
[20:56:49] CMySQLHandler::StoreResult() - Result was stored.
[20:56:49] >> mysql_fetch_row_format( Connection handle: 1 )
[20:56:49] CMySQLHandler::FetchRow() - Return: 1|My_Username|mypassword|1|50|48|49|51|0|0|1|0|16|0|0|0|0|500|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|255|0|0|0|0|0|0|0|0|5|0|0|0|0|0|0|100|0|255|3|135|980033|255|76|255|5|1|3|1526.27|-1694.23|13.3828|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|1|0|0|25|7|1|25|7|49|0|0|49|0|0|0|0|0|0|0|0|0|0|0|0|0|999|0|0|0|7|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1351866576|0|0
[20:56:49] >> mysql_fetch_field_row( Connection handle: 1 )
Reply
#4

DBan?
Reply
#5

Help anyone?
Reply
#6

Afaik an id isn't a string.

Quote:

format(Query, sizeof(Query), "SELECT * FROM `players` WHERE `id` = '%d'", KasutajaInfo[playerid][pSQLID] );

should be

Quote:

format(Query, sizeof(Query), "SELECT * FROM `players` WHERE `id` = %d", KasutajaInfo[playerid][pSQLID] );

Reply
#7

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Afaik an id isn't a string.



should be
Aam... You didn't make any changes there.
Reply
#8

Help, anyone?
Reply
#9

Quote:
Originally Posted by tsonn1
Посмотреть сообщение
Aam... You didn't make any changes there.
yes he did he had changed `id` = '%d'", KasutajaInfo[playerid][pSQLID] );

he removed the '' around the %d as it's a number and not a string. what he's basically saying
Reply
#10

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Afaik an id isn't a string.



should be
Do you realize that you can also wrap integers with single quotes?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)