View Full Version : CSV, retrieving and editing data

01-20-2012, 10:40 PM

I am attempting to let my users edit a CSV file from their control panel. They all should have 2 "slots". I am using the following format:


What it should do is it should be able to check how many slots you have used, in this case the person Laur3ns used 2 of them and Aronnn only 1. I can develop a panel which allows you to update them both but do not know how to check if they are used and if not add one, and if it is used, update it. The current code I am using to output it is:

$file_handle = fopen("warps.csv", "r");
while (!feof($file_handle) ) {
$line = fgetcsv($file_handle, 1024);
print $line[0] . $line[1] . $line[2] . $line[3] . $line[4] . $line[5] . $line[6] . $line[7] . "<BR>";

If anybody could help me I could highly appreciate it,

01-20-2012, 10:56 PM
I suggest using a database for things like this. You can easily manipulate data like this in a database and create easy to use interfaces for it. You can also export data to CSV if you need to.

01-21-2012, 10:37 AM
Thank you for your reply,
I am currently using a plugin that outputs in a CSV file and can only be changed through CSV. I already thought of porting it to MYSQL but since the source has not been released I need to do it with CSV (the plugin is writen in java).

01-21-2012, 08:36 PM

That could be something that applies. Have a good look through it.