<div dir="ltr"><font color="#3333ff">Hi List,</font><div><font color="#3333ff"><br></font></div><div><font color="#3333ff">Below is my code by which I have connected Lua and mysql DB and displayed into FreeSwitch CLI.</font></div>
<div><font color="#3333ff"><br></font></div><div><div><font color="#3333ff">local dbh = freeswitch.Dbh("Billing","Billing","Tzru9unbcfuW6PV")</font></div><div><font color="#3333ff">if assert(dbh:connected()) == true then</font></div>
<div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", "connected");</font></div><div><font color="#3333ff">assert(dbh:query("SELECT id, profile_name FROM sofia_conf", function(row)</font></div>
<div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>for key, val in pairs(row) do</font></div><div><font color="#3333ff"> row[key] = val</font></div><div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", " <a href="http://row.id">row.id</a>");</font></div>
<div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", " profile_name");</font></div><div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", "row[key]");</font></div>
<div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", " profile_name");</font></div><div><font color="#3333ff"> end</font></div>
<div><font color="#3333ff"> end))</font></div><div><font color="#3333ff"> -- stream:write(string.format("%5s : %s\n", <a href="http://row.id">row.id</a>, row.profile_name))</font></div><div><font color="#3333ff">-- end)</font></div>
<div><font color="#3333ff">else </font></div><div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog("info", "not connected");</font></div><div><font color="#3333ff">end</font></div>
<div><font color="#3333ff"><br></font></div><div><font color="#3333ff">How to get and store values from mysql database to Lua variables ?</font></div><div><font color="#3333ff"><br></font></div><font color="#3333ff">-- <br>
</font><div dir="ltr"><font color="#3333ff"><br>Thanks and regards<br><br> Virendra Bhati<br>+91-8885268942<br>Software Engineer<br>E-mail-: <a href="mailto:virbhati@gmail.com" target="_blank">virbhati@gmail.com</a><br>Skype id:- virbhati2<br>
Hyderabad(India)<br></font></div><br>
</div></div>