RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

MyRunUO data to MySQL db issue (PHP)

Jarrod

Sorceror
MyRunUO data to MySQL db issue (PHP)

Hi all,

No this isnt a "omg how i do instal thiz!?" thread, so back away from the [FLAME] key ;)

I have everything installed on the server.
Im using Apache
Im using PHP script release (not .asp files)

the MySQL database is set up and works beautifully. I can query it to death, no errors.
the MyRunUO distro scripts are in place and active.
the .php files also work and can query the DB, but return no values, as the tables are empty.

thats the problem. MyRunUO is not feeding the database. I started to track what the problem could be.

As status is the entry page, i started with that.

in MyRunUOStatus.cs at line 58 i found the following:
m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status() VALUES ({0})", mob.Serial.Value.ToString() ) );

???

inserting the value into WHAT?? and where are location, map, karma, and fame?

running something like that on the mySQL directly would throw errors as well. the syntax is wrong. I changed it to this:

m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status(char_id, char_location, char_map, char_karma, char_fame) VALUES ({0}, {1}, {2}, {3}, {4})", mob.Serial.Value.ToString(), null, mob.Map, mob.Karma, mob.Fame ) );

So. now we know what should be entered where. However, when running this, its still not giving any info into the database. (root does have access to the DB, so its not an access thing i think)

So i added a console line to see what exactly its trying to feed the DB:


PHP:
					if ( mob != null )
					{
				      m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status(char_id, char_location, char_map, char_karma, char_fame)  VALUES ({0}, {1}, {2}, {3}, {4})", mob.Serial.Value.ToString(), null, mob.Map, mob.Karma, mob.Fame ) );
				      Console.WriteLine( "adding {0}, {1}, {2}, {3}, {4})", mob.Serial.Value.ToString(), null, mob.Map, mob.Karma, mob.Fame);
				   }

the result when i enter [updatemyrunuo :
PHP:
MyRunUO: Status database updated in 0,0 seconds
adding 22242, , Felucca, 0, 1806)
adding 3630, , Felucca, 12506, 15000)
MyRunUO: Updating character database
MyRunUO: Characeter database updated in 0,0 seconds
MyRunUO: Database statements compiled in 0,78 seconds

so i see it is reading the values correctly.... but in the database there is still no information...

at least in the MyRunUO.cs the values are correct on INSERT
ExecuteNonQuery( "INSERT INTO myrunuo_characters (char_id, char_name, char_str, char_dex, char_int, char_female, char_counts, char_guild, char_guildtitle, char_nototitle, char_bodyhue, char_public ) VALUES ({0}, '{1}', {2}, {3}, {4}, {5}, {6}, {7}, {8}, '{9}', {10}, {11})", mob.Serial.Value.ToString(), SafeString( mob.Name ), mob.RawStr.ToString(), mob.RawDex.ToString(), mob.RawInt.ToString(), female, mob.Kills.ToString(), guildId, guildTitle, notoTitle, mob.Hue.ToString(), pubString );

so i know the values are good in the .cs files... the MySQL database (MyRunUO) is also fine.. where could the problem be originating from that the data sets are not being fed into the database? the Console isnt showing any errors at all.

Thanks in advance.
 

Phantom

Knight
You clearly modified the script, because it does work by default.

Double check everything, if it still doesn't work, post all the code your using.
 

noobie

Wanderer
Config.Enabled is true or false ? :)
it should be true.

i guess the reason why only the serial number is stored in the status table is you can access mobile info from another table (myrunuo_characters) using that serial number (no need to duplicate values in db)
 

Jarrod

Sorceror
ok i checked the files again. the only one difference was in DataCommandQueue.cs

I had ThreadStart set to true. In distro, its false. I set it back to false, and now the database has populated, but in console its throwing an exception:

PHP:
MyRunUO: Updating status database
MyRunUO: Exception caught in database thread
System.Data.Odbc.OdbcException: ERROR [HYT00] Column count doesn't match value count at row 1
   at System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle, SQL_HANDLE
 hType, RETCODE retcode)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,
 String method)
   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()
   at Server.Engines.MyRunUO.DatabaseCommandQueue.Thread_Start()


myrunuo_status (and myrunuo_timestamps) are not being fed.

the table structure is
CREATE TABLE myrunuo_status (
char_id Int(12) UNSIGNED,
char_location VARCHAR(14),
char_map VARCHAR(8),
char_karma Int(6),
char_fame Int(6));


in the distro MyRunUOStatus.cs, line 58
m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status VALUES ({0})", mob.Serial.Value.ToString() ) );
the syntax is definately wrong, as the value is being written into nowhere. It should be:
m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status (char_id) VALUES ({0})", mob.Serial.Value.ToString() ) );

now the error has stopped, and it is showing how many players are online. Now i just have to get rid of the "red X" problem, but there are already numerous posts on that. Ill dive through those first.

Thanks to Phantom for the heads up on the distro file checking.
 
Top