<div dir="ltr">A select that returns 0 rows does not always mean error. <div>If you make your SQL do a little more specific lookup, you can avoid the loop entirely.<div><br></div><div style>Instead of your:</div><div style>
readsql=SELECT pin from users WHERE confid=&#39;${SQL_ESC(${CONF_ID})}&#39;<br></div><div style><br></div><div style>Something like:</div><div style>readsql=select if(count(value)=0,0,1) from users where confid = &#39;${SQL_ESC(${ARG1})}&#39; and pin = &#39;${SQL_ESC(${ARG2})}&#39;  ;<br>
</div><div><br></div><div style>This will then take two arguments, the first is the conf id, the second is the entered PIN.</div><div style>It will return either 0 or 1.  1 if the pin and conf are a valid pair, 0 if not.</div>
<div style><br></div><div style>Then in dialplan, simply check the return value.</div><div style><br></div><div style><br></div><div style><br></div><div style>While your approach to getting the pin does work, I personnally would use READ() as others have suggested.</div>
<div style><br></div><div style><br></div><div class="gmail_extra"><br></div></div></div>