[Asterisk-Users] Retrieve multiple variables from database using MYSQL cmd

Ben Higley pbx at itsngroup.com
Fri Nov 18 22:17:27 MST 2005


I'm trying to retrieve multiple variables for a database into their
respective  variable names.

i.e.

select technology,username,password,servername from mytable where type=1

then I want to capture those values for those columns into a variable name
by the name of the column.

i.e.

if technology = iax2 then the variable technology will now be set to iax2
and so on and so forth.. so at the end of all the mysql selects / fetches
etc..

i would end up withs ometing

technology=iax2
username=ben
password=mypassword
servername=myservername


I am trying to do the example from the MYSQL cmd on the wiki, but when I
try to iterate through the variables i always get "num fields=4, more
fields than variables.

Has anyone done this, and could shed some light?

I have sucessfully extracted a single variable from a database, however in
this case, i need more data from a single select statment..

Thanks...

Ben





More information about the asterisk-users mailing list