Mysql support in asterisk

Hello,

I am trying to use the mysql_app in the asterisk for which the dialplan is given below. The two bold statements are correct or not.

[globals]
DBCurrentHost=localhost
DBname=mtsdb
DBuser=root
DBpass=

[users]
exten=>6001,1,VoiceFun(1)
exten=>6001,n,Dial(SIP/test_phone_avishek,20)
exten=>6002,1,VoiceFun(4)
exten=>6002,n,MYSQL(Connect connid ${DBCurrentHost} ${DBuser} ${DBpass} ${DBname})
exten=>6002,n,Verbose(2,“Connection Id is ${connid}”)
exten=>6002,n,GotoIf($["${connid}" = “”]?error,1)
exten=>6002,n,MYSQL(Query resultid ${connid} SELECT contact_number FROM contacts_table)
exten=>6002,n(fetchrow),MYSQL(Fetch foundRow ${resultid} contact_number) ; fetch row
exten=>6002,n,GotoIf($["${foundRow}" = “1”]?done) ; leave loop if no row found
exten=>6002,n,NoOp(${contact_number})
exten=>6002,n,Goto(fetchrow) ; continue loop if row found
exten=>6002,n(done),MYSQL(Clear ${resultid})
exten=>6002,n,MYSQL(Disconnect ${connid})

exten=>error,1,NoOp(Connection error - do whatever we have to do to crash nicely!)
exten=>error,n,Hangup

;exten=>6002,1,Monitor(wav,/tmp/test)
exten=>6002,n,Dial(SIP/test_phone_demo,20)

i am not sure the way you are implementing the query
i use something like below

exten => s,1,Set(ODBC_ID=${get_market_report()})

same => n,Set(COUNTER=1)
same => n,While($[${COUNTER} <= ${ODBCROWS}])
same => n,Set(ARRAY(apcd,maxrt,minrt)=${ODBC_FETCH(${ODBC_ID})})

and in func_odbc.conf
[market_report]
prefix=get
dsn=mysqlserver
mode=multirow
readsql= select apcd, max(rate) as maxrt , min(rate) as minrt from lot1314 where (date1= (select max(date1)from lot1314 )) and apcd in(1,7,15) group by apcd