<div dir="ltr"><div>Thanks for reply. <br><br>row["inp_"..input]<br><br></div>Solved the problem.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 May 2015 at 07:33, Abaci B <span dir="ltr"><<a href="mailto:abaci64@gmail.com" target="_blank">abaci64@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">try <span style="font-size:12.8000001907349px"> </span><b style="font-size:12.8000001907349px"> lang = row[inp_..input]</b><br style="font-size:12.8000001907349px"></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, May 19, 2015 at 10:07 AM, Aqs Younas <span dir="ltr"><<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>