Jump to content

Get a value from MYSQL in quest


Recommended Posts

Hi guys!
I was trying to get values from mysql in quest, but I wasn't very successful with it, so I came here to get some help.

I created a ,,petLevel" column in player.player table and I'd like to get the value in quest, of course the petLevel is different for each person, so I want to get the person petLevel who clicks on a pet.
I tried something like this:
local petLevel = mysql_direct_query("SELECT petLevel FROM player.player WHERE name = "..pc.get_name().." LIMIT 1;")
But it says it's: 4294967295, the value in mysql is 4

I can't solve it, I tried a lot of method but it doesn't want to work for me.

Thanks for the help!

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Premium
55 minutes ago, redscoutyt2 said:

Hi guys!
I was trying to get values from mysql in quest, but I wasn't very successful with it, so I came here to get some help.

I created a ,,petLevel" column in player.player table and I'd like to get the value in quest, of course the petLevel is different for each person, so I want to get the person petLevel who clicks on a pet.
I tried something like this:
local petLevel = mysql_direct_query("SELECT petLevel FROM player.player WHERE name = "..pc.get_name().." LIMIT 1;")
But it says it's: 4294967295, the value in mysql is 4

I can't solve it, I tried a lot of method but it doesn't want to work for me.

Thanks for the help!

i dont know how to do this in Lua but in C++ it would look like this :

 

    char Query[512];
	snprintf(Query, sizeof(Query), "SELECT * FROM player.horse WHERE PID = %d", GetPlayerID());
	std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(Query));

	if (msg->Get()->uiNumRows == 0)
	{
		return;
	}
	else
	{
		MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
		str_to_number(MyHorse.Level,		row[1]);
		return;
	}

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.