michel225 Posted September 1, 2013 Share Posted September 1, 2013 Hallo I have the following problem. I have a CSV file with articles (for joomla) that I want to import to my server through phpmyadmin. Now after figuring out how to import date format i came across my second problem, and that is how to import the articles that is stored in a cell that is in a csv-load date file???? The problem is that when importing it, I don't see any line breaks in the articles, not in joomla and not in the html code that sould be stored in phpmyadmin. (In the CSV file I see line breaks, just like when copying it to word, but not on the server) So I hope that somebody can help me with that Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/ Share on other sites More sharing options...
vinny42 Posted September 1, 2013 Share Posted September 1, 2013 Do you get the HTML into the database and it's only the newlines that are missing? How are you looking at the HTML after importing, are you perhaps looking at it in a browser (because browsers don't render newlines) Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447628 Share on other sites More sharing options...
michel225 Posted September 1, 2013 Author Share Posted September 1, 2013 thanks for answering It's not that i'm looking for html codes but want in the date that i put in the server to have break lines (so <br > or <p >) When importing date with a CSV Load-Date file thourgh phpmyadmin, you have a function that automatically detects line breaks en converts them to <p > or <br > html codes (I think) but it doesn't seem to work when I do that??? Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447632 Share on other sites More sharing options...
vinny42 Posted September 1, 2013 Share Posted September 1, 2013 I don't understand what you mean. Yo cannot arbitrarily replace newlines with BR tags, that would break all your data. I'd suggest that you should import the CSV without making any replacements using phpmyadmin (which is a *crappy* tool anyway) and use UPDATE queries on the columns where you want to replace newlines with BR tags. Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447633 Share on other sites More sharing options...
michel225 Posted September 1, 2013 Author Share Posted September 1, 2013 OOOh thanks would you mind telling me how to update the columns in phpmyadmin, im really new in that thanks Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447640 Share on other sites More sharing options...
vinny42 Posted September 1, 2013 Share Posted September 1, 2013 I had a feeling you were new to the whole SQL thing :-) First a warning; replacing newlines with BR tags in the HTML is usually not a good idea because a newline formats the HTML source, whereas a BR tag formats the rendered HTML page. If the source contains "<br>\n" (this is very common in html) then you definately do not want to replace that with "<br><br>" because your page would look different. What's more, you cannot go back to "<br>\n" because of the same reason. You have been warned. That said; replacing a string "\n" with "<br>" in the column named "your_column_name" in the table named "your_table" is as simple as this: UPDATE your_table SET your_column_name = REPLACE(your_column_name, "\n", "<br>"); See also: dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447660 Share on other sites More sharing options...
michel225 Posted September 1, 2013 Author Share Posted September 1, 2013 omg, thanks mate, really helped Quote Link to comment https://forums.phpfreaks.com/topic/281741-phpmyadmin-import-csv-load-date-with-line-breaks/#findComment-1447664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.