• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Sql query

tiddpd

PHP Scripter
Joined
Apr 16, 2008
Messages
331
Reaction score
0
I have the sql query right, however I'm trying to print it out in game. I've tried the query in phpmyadmin and it worked fine. So I am trying to get the result in game.

What I have it doing is counting the amount of answers in my vote. Anyways heres what I'm attempting which of course is not working.

Code:
		local result = db.getResult("SELECT COUNT(pvp) FROM vote_ans WHERE pvp=1")
		local textout = result:getDataInt("pvp")
		doPlayerSendTextMessage(cid, 19, "test " .. textout .. ".")

This is not the whole code, just the section where I'm having problems. For example there are 3 votes for pvp, and I want it to say 3. How can I do this?

Error:

Code:
[07/04/2009 21:18:52] Error during getDataInt(pvp).
 
local result = db.getResult("SELECT COUNT(pvp) AS count FROM vote_ans WHERE pvp=1")
local textout = result:getDataInt("count")
doPlayerSendTextMessage(cid, 19, "test " .. textout .. ".")
 
lol that worked... i swear a tried that before though --thanks REP ++

edit: nevermind i see another change you made
 
I have another one that I been trying to figure out for a couple days... I had it so it logs the players ip in the sql server too, so if they tried to vote again it checks for ip instead of character storage (therefore they can vote again on another char), the only problem I had was trying to get it to check for ip.

How would I do that?
 
Back
Top