Jump to content

csv creation problem


perezf

Recommended Posts

Hello everyone, currently i created a script that exports data from a database.

I have a bit of a problem though since a CSV is comma delimited.

This field that i need to export data from has commas in it and that screws up the whole file.

Does anyone have a solution?

Link to comment
https://forums.phpfreaks.com/topic/124692-csv-creation-problem/
Share on other sites

yes i did here is a sample of what i did

while($row = mysql_fetch_array($result)) { 
$csv_output .= 
				'"' . $row['products_id'] . '",' . 
				'"' . $row['products_name'] . '",' . 
				'"' . $row['products_model'] . '",' . 
				'"' . 'R' . '",' . 
				'"' . $row['products_price'] . '",' . 
				'"' . 0 . '",' . 
				'"' . '' . '",' . 
				'"' . '' . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . $row['products_name'] . '",' . 
				'"' . $row['products_description'] . '",' . 
				'"' . $row['products_description'] . '",' . 
				'"' . '' . '",' . 
				'"' . 'default' . '",' . 
				'"' . 'dsimg' . '",' . 
				'"' . 3 . '",' . 
				'"' . 0 . '",' . 
				'"' . $row['products_image'] . '",' . 
				'"' . $row['products_image'] . '",' . 
				'"' . $row['products_image'] . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . 0 . '",' . 
				'"' . 1 . '",' . 
				'"' . 1 . '",' 
				;
$csv_output .= "\n";
} 

 

Link to comment
https://forums.phpfreaks.com/topic/124692-csv-creation-problem/#findComment-644064
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.