jesusroldan Posted May 6, 2021 Share Posted May 6, 2021 (edited) Hello everybody. I am developing a module to be able to download custom data about the products to a CSV file. I find the problem when trying to insert the description (long) field in the CSV. This field is added in the database as html text and stores newlines within itself, and this for a CSV file is a very bad thing, since it takes each newline as a new item. I'm looking for a PHP or SQL function similar to strip_tags or trim to help me remove this line break before putting the information in the final CSV. Thank you in advance for your help. Edited May 6, 2021 by jesusroldan Problem solved (see edit history) Link to comment Share on other sites More sharing options...
jesusroldan Posted May 6, 2021 Author Share Posted May 6, 2021 14 minutes ago, jesusroldan said: Hello everybody. I am developing a module to be able to download custom data about the products to a CSV file. I find the problem when trying to insert the description (long) field in the CSV. This field is added in the database as html text and stores newlines within itself, and this for a CSV file is a very bad thing, since it takes each newline as a new item. I'm looking for a PHP or SQL function similar to strip_tags or trim to help me remove this line break before putting the information in the final CSV. Thank you in advance for your help. I have solved the problem using this SQL statement: SELECT REPLACE(REPLACE(description,CHAR(13),' '),CHAR(10),' ') FROM ps_product_lang; I've been faster than the forum hehehe Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now