<div dir="ltr">Sorry, i resolved the issue. Thanks.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 May 2015 at 07:07, Aqs Younas <span dir="ltr"><<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi, users. <br></div><br></div>I am trying to fetch language from database through freeswitch dbh after user presses some digits on main message. <br><br></div>Database table structure is as follow. <br><br></div>Id Did inp_1 inp_2 inp_3<br><br></div>1 <a href="tel:14048002020" value="+14048002020" target="_blank">14045872020</a> english chinese hindi<br><br> <b>input</b> = session:playAndGetDigits(1, 1, 3, 3000, "#",main_msg, "/error.wav", "\\d")<br>session:consoleLog("info", "Caller pressed : ".. input .."\n")<br><br>sql ="select inp_"..input.." from bible_main where Did = "..Dest<br>session:consoleLog("info", "SQL : ".. sql .."\n")<br><br>dbh:query(sql, function(row)<br> <b> lang = row.inp_..input</b><br> session:consoleLog("info", "Caller has Selected : ".. lang .."\n")<br>end)<br></div><br><div>Running above code gives me below error.<br>2015-05-17 02:26:20.057184 [ERR] mod_lua.cpp:103 /usr/local/freeswitch/scripts/bible.lua:27: attempt to concatenate field 'inp_' (a nil value)<br>stack traceback:<br> /usr/local/freeswitch/scripts/bible.lua:27: in function </usr/local/freeswitch/scripts/bible.lua:25><br> [C]: in function 'query'<br> /usr/local/freeswitch/scripts/bible.lua:25: in main chunk<br><br></div><div>Actually, i do not know how to concatenate a table value with string so that it reflects the table column. So, i can get value from this. <br></div><div><br></div><div>Running it like this, gives perfect result. <br><br>dbh:query(sql, function(row)<br> <b> lang = row.inp_1</b><br> session:consoleLog("info", "Caller has Selected : ".. lang .."\n")<br>end)<br><br>But I want user's input not some hard coded values for input. <br><br><br>Any help in this regard.<br></div><div>Thanks.<br></div></div>
</blockquote></div><br></div>