Reading data from MySQL Database


How can I read a value from MySQL Database on the basis of the value entered by the user. for e.g if a user dials in and press 123 when asked for his/her ID, I want to look in a table and search for the record of customer 123 and played back his/her balance/amount/anything


there are two ways to do this

  1. use the dialplan- Read() to store the input to a variable, then use MySQL() to connect to the dbase, select it, store that result to another variable and then close the database, then ExecIf or GotoIf to evaluate what the database got us.

  2. use AGI. Using AGI you can write a PHP application that will be executed from the dialplan and can read a few digits and check them against MySQL.