[ERROR] BCStorm

Forget

Member
Apr 3, 2012
120
14
Hello DevBest,
This is just a simple bug and it's to do with MySQL however I can't find what it is, So I have gave you people on DevBest the challenge. It is something to do with my table structure that I am using for the pets table in the database. The error shown below is the error which can by found in my MySQL Error file on the emulator. On the console the error that was wrote was "Error caught in query". The error that I have is the parameter "@name" is null and it contains no name, when the pet it'self have the name "Test4" this name contains no invalid characters so that should not be the issue.

Error (MySQL Error File)
Code:
Error in query:
UPDATE user_pets SET room_id = 0, name = [URL='http://devbest.com/members/name.7391/']name[/URL], race = @race, color = @color, type = 15, expirience = 0, energy = 100, nutrition = 100, respect = 0, createstamp = '1365903481', x = 0, Y = 0, Z = 0 WHERE id = 4
MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Parameter '@name' must be defined.
  at MySql.Data.MySqlClient.Statement.SerializeParameter(MySqlParameterCollection parameters, MySqlPacket packet, String parmName)
  at MySql.Data.MySqlClient.Statement.InternalBindParameters(String sql, MySqlParameterCollection parameters, MySqlPacket packet)
  at MySql.Data.MySqlClient.Statement.BindParameters()
  at MySql.Data.MySqlClient.PreparableStatement.Execute()
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
  at Database_Manager.Database.Session_Details.QueryAdapter.runQuery()

Many thanks,
Kieran.
 

Forget

Member
Apr 3, 2012
120
14
Yeah it's the latest version, however that would have nothing at all to do with a error.
Look at the line:

MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Parameter '@name' must be defined.



That tells you what the error is and as you can see the parameter doesn't have a value, so according to the pet it doesn't have a name however it does.
 

Forget

Member
Apr 3, 2012
120
14
I think 4 is an invalid character, I don't think you can have numbers..

Looking at the emulator code in further depth, it's got no restrictions on numeric inputs only <, >, ' and a couple of others. These have also been places on the catalogue page so it can not be bought since these are characters that can be used for minor SQLinjection.

The actual issue as stated in the error file, which I have copied and pasted on here is the variable is not defined, so I am guessing this is to do with defining the variable outside of the function or something along those lines. It should not have anything to do with the content which is inside the parameter.

Thank you for your suggestion though.
 

Users who are viewing this thread

Top