<div dir="ltr">Scope - row only exists inside the function since it&#39;s a function argument</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 August 2014 08:58, Shabbir abbasi <span dir="ltr">&lt;<a href="mailto:shabbirabbasi92@gmail.com" target="_blank">shabbirabbasi92@gmail.com</a>&gt;</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>i am  testing  a script      new_chat.lua    script is below<br></div><br>#!/usr/bin/lua<br>local dbh = freeswitch.Dbh(&quot;odbc://dbname:db_username:db_passwd&quot;) -- connect to ODBC database <br>


assert(dbh:connected()) -- exits the script if we didn&#39;t connect properly<br><br>if dbh:connected() == false then<br>   freeswitch.consoleLog(&quot;ALERT&quot;, &quot;lua cannot connect to database&quot; .. dsn .. &quot;\n&quot;);<br>


end<br><br>sql_query    = &quot;SELECT * FROM cc_card WHERE id =&#39;197&#39;&quot;<br>dbh:query(sql_query ,function(row)<br>for key, val in pairs(row) do   <br>key = val<br>end<br> freeswitch.consoleLog(&quot;INFO&quot;,&quot; inside  QUERY lastname = &quot; .. row.lastname .. &quot;\n&quot;);<br>


freeswitch.consoleLog(&quot;INFO&quot;,&quot; inside  QUERY  redial = &quot; .. row.redial .. &quot;\n&quot;);<br>end)<br><br>freeswitch.consoleLog(&quot;INFO&quot;,&quot; outside  QUERY  lastname = &quot; .. row.lastname .. &quot;\n&quot;);<br>


freeswitch.consoleLog(&quot;INFO&quot;,&quot;  outside  QUERY    redial = &quot; .. row.redial .. &quot;\n&quot;);<br><br>freeswitch.consoleLog(&quot;INFO&quot;,&quot; outside  QUERY  lastname = &quot; .. lastname .. &quot;\n&quot;);<br>


freeswitch.consoleLog(&quot;INFO&quot;,&quot;  outside  QUERY    redial = &quot; .. redial .. &quot;\n&quot;);<br><br>dbh:release() -- optional<br><br></div>but here is some problum    in this script  inside query lines are  working  but outside query lines  are not working  WHY  ??   <br>


 any suggestions are very wellcome<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>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.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://wiki.freeswitch.org" target="_blank">http://wiki.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>
<br></blockquote></div><br></div>