<div dir="ltr">The function you pass to dbh:query is a callback. It is run for every row in the result set, in order.<div><br></div><div>1) Will be qrow on 2nd invocation</div><div>2) 'count = count + 1' on each invocation</div><div>3) Print on all invocations. You should be seeing that already, so perhaps the 2nd row isn't selected by your SQL query?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 December 2014 at 05:31, Shabbir abbasi <span dir="ltr"><<a href="mailto:shabbirabbasi92@gmail.com" target="_blank">shabbirabbasi92@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>if i execute a query in mysql select dialprefix,rateinitial from cc_ratecard where (dialprefix='001' or dialprefix='00123') ORDER BY LENGTH(dialprefix) DESC;<br><br></div>result<br></div>row1 | 001 | 0.01000 |<br><div>row22 | 00123 | 0.02000 |<br><br></div><div>and this is lua code <br><br>local rates = {}<br>local count = "";<br><br> assert(dbh:query(query, function(qrow)<br> for key, val in pairs(qrow) do<br> rates[key] = val<br>freeswitch.consoleLog("INFO"," rates :"..key.. "..="..val.." \n")<br> end<br>count = qrow.count;<br> end))<br><br></div><div>questios is <br>1 how to select 2nd row from result ? <br></div><div>2 how to count total rows ?<br></div><div>3 how to print all 2 rows in console ?<br><br></div><div>any suggestios wellcome<br></div></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">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com">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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></blockquote></div><br></div>