I'd like to import into my MySQL database some text files (like news, etc.). Which is the best way to format the chart?

Those file are text file (.txt) with news content. Then I post those files on my homepage. The first line of the original text file is the title, other lines are the text.

Which is the best way to extract those file and post them properly? Should I create 2 coloumn, post the title (first class) on the first coloumn and the rest of text on the second coloumn?

有帮助吗?

解决方案

Yes create a MySQL table called "news" with fields id (int, auto increment), title (varchar 255) and body (mediumtext).

Then use file to get an array of lines in the text file, and insert into the table with title being the first element in the array and the rest in body.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top