How to Work with PostgreSQL Function Output in PHP

mohammed

New Member
I have a postgresql (V 8.4) function that returns SETOF a custom type. An example of the string output from this function is the following 4 rows:\[code\](2,"CD,100"," ","2010-09-08 14:07:59",New,0,,,,,,"2010-09-06 16:51:51","2010-09-07 16:51:57",)(5,CD101,asdf,"2010-08-08 14:12:00",Suspended-Screen,1,10000,,,,,,,)(4,DNR100,asdf,"2010-09-08 14:10:31",Suspended-Investgate,0,,,,,,"2010-09-06 16:51:51","2010-09-07 16:51:57",)(3,MNSCU100," ","2010-09-08 14:09:07",Active,0,,,,,,,,)\[/code\]I need to work with this data in PHP and I'm trying to figure out the best way to work with it. What I would love is if there was a way for postgresql to return this like a table where columns represent each value within a record rather than as a comma-separated string.Is this possible? If not, what is the best way to work with this comma-separated string of values in PHP? I've see this post (http://stackoverflow.com/questions/3068683/convert-postgresql-array-to-php-array) and can use the function mentioned there but I wanted to ask if anyone has other ideas or suggestions. Thanks, Bart
 
Back
Top