Welcome Guest, Not a member yet? Register   Sign In
use multiple query result on csv genration function
#1

[eluser]Unknown[/eluser]
Hi all

this the fires topic for me ,,

i want to generate csv file but the required data is very complected and requires multiple tables , therefore , i think that i need multiple query than passing them to xml_from_result or csv_from_result to generate both xml and csv files , i try to use join sql query , but it is duplicate some values for example section for 3 employee , the result will be duplication for all section name and employees name, also , i try to generate xml string and concatenate them to make one xml but the xml_from_result generate the root tag for each results ,,

i hop that i can fined solution for my problem with you ,,,,

thanks in advance ,,
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

If you're using a JOIN, you're probably going to have to deal with the cross join effects. Your best option will probably be to build your CSV string by programatically. You might need to loop through your data twice. The first time to build an array in the format you need it to be in, by creating a multi-demensional array, and another loop to build the CSV from that multi-dimensional array. It would probably be possible to do it in a single loop, but I doubt it will be as simple.




Theme © iAndrew 2016 - Forum software by © MyBB