Jump to content
Forgot your email address? ×
×
×
  • Create New...
  • 0

How can I select a string from mysql?


Dimmi

Question

Hi guys.

How can I make a function to select a string (varchar in database) in a quest.

For example, to select "test" (which is an integer) from table "test", I use a function like this:

function get_test ()
	local r = mysql.query("SELECT test FROM player.test LIMIT 1")
	return r[1][1]
end

How can I make a function to select a string?

Please help!

Link to comment
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 0
  • Premium

It returns

nil

but thanks for advice, anyway...

 

That's strange. It should actually work exactly how selecting integer works.

Try using extended MySQL query: 

SELECT `column` FROM player.table LIMIT 1;

Also, do you use source? It would be easier to use the source.

Link to comment
  • 0

It returns

nil

but thanks for advice, anyway...

That's strange. It should actually work exactly how selecting integer works.

Try using extended MySQL query:

SELECT `column` FROM player.table LIMIT 1;
Also, do you use source? It would be easier to use the source.

Yes, I'm using source. Function I used (mysql.query) was added by source, but the query it's ok, cuz' always I test my query in Navicat. The problem is in variable (I think), because integer variable works.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


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.