Jump to content

How can I select a string from mysql?


Recommended Posts

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
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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
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.