How to insert a value in mysql?

greetings!!

i need your help!, i dont know how to insert a value in a mysql table…

i have a db in mysql, and i need to insert values with the dial plan, but i dont know how.

could somebody give me a example?
i know that i have to use the applicacion mysql()
but i dont have any idea of how to use it :frowning:

thanks for your help! :smiley:

exten => 1,1,MYSQL(Connect connid localhost root pass db)

(one line: )
exten => 1,n,MYSQL(Query resultid ${connid} INSERT\ INTO\ table\ SET\ foo=${bar}, blah=${GLOBALS(woot)})

exten => 1,n,MYSQL(Disconnect ${connid})

-bk

[quote=“bkruse”]exten => 1,1,MYSQL(Connect connid localhost root pass db)

(one line: )
exten => 1,n,MYSQL(Query resultid ${connid} INSERT\ INTO\ table\ SET\ foo=${bar}, blah=${GLOBALS(woot)})

exten => 1,n,MYSQL(Disconnect ${connid})

-bk[/quote]

i was able to insert values with this code

exten => 21,1,Answer
exten => 21,2,read(NUMBER,15,30)
exteb => 21,3,MYSQL(Connect connid localhost asterisk asterisk asteriskdb)
exten =>21,4,MYSQL(Query resultid ${connid} ‘INSERT INTO ‘asteriskdb’.‘prueba’ (‘numero’) Values (’${NUMBER}’) ')

:smiley:

but now…i need to create a extencion that locate a digited number in a table of my data base, and if the digited number exist
playback(message1)
if not exist
Playback(message2)

can some body help with this problem?

thank! :smiley:

core show application mysql.

I would also suggest learning sql as you can just select ext from extensions where ext = ‘6115’; to get the sound for my 6115 extension, etc.

-bk