Ben Higley
2005-Nov-18 22:17 UTC
[Asterisk-Users] Retrieve multiple variables from database using MYSQL cmd
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
Are
2005-Nov-19 11:53 UTC
[Asterisk-Users] Retrieve multiple variables from database using MYSQL cmd
Hi Ben If I remember correct you have to do one SQL statement for each value you want to return. technology = select technology from mytable where type=1 username = select username from mytable where type=1 password = select password from mytable where type=1 servername = select servername from mytable where type=1 This is the reason I prefeer to work with PERL script in AGI having perl talk to SQL. -- Are Casilla http://astartelecom.com - Independent VOIP Telecoms Broker. Asterisk Consultants http://astbill.com - Open Source Billing, Routing and Management software for Asterisk and VOIP AstBill DEMO: http://demo.astbill.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20051119/26be5f80/attachment.htm