[wp-hackers] Storing Tabular Content in the Database

Jason Webster jason at intraffic.net
Wed Feb 18 05:33:28 GMT 2009


One option would be simply storing the CSV file as a CSV file.
PHP has limited support for the CSV format natively <http://ca.php.net/fgetcsv> and there are many 
more advanced libraries available in the wild.

On 17/02/2009 10:02 AM, Mohammed K. al-Safi wrote:
> My question is about allowing WordPress users to easily display tabular
> content on their blog; providing them with tools to easily do so.
>
> I'm creating a plugin that will ask the user to select a CSV file from their
> HDD and then store the content of this CSV file, *some how*, and display it
> as HTML on a page or a post. I know, there already is a plugin by Alex Rabe
> called wp-Table. However, I believe there is plenty of room in this area for
> another plugin.
>
> At any rate, I need your help on how I should store the tabular content that
> the user uploads via this plugin.
>
> My first thought was to take a CSV file and create a new MySQL table that
> mirrors the CSV file. So, for every CSV file the user wants to display on
> the blog, I'd end up with a corresponding MySQL table in WP's database. I
> would also create a table to keep track of these CSV tables.
>
> I explained the aforementioned implementation to some people on irc://
> irc.freenode.net/mysql and they said that this is definitely not the way to
> do it. They were talking about database schemas, data normalization and some
> stuff that, honestly, I don't think is practicable or applicable for this
> plugin. But the people in the IRC channel didn't really understand the
> situation as well as you would, so I want your opinion and help.
>
> As an alternative solution, I thought that maybe I will generate the HTML
> for the table, and just store that. Kind of like how WordPress would store a
> post or something...
>
> Which implementation should I follow?
>
> Thanks,
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list