How do I display whatever that gets submitted in a CSV File on an HTML Web Page by pulling it with php... I am kind of lost....?

Member Avatar

LastMitch

@<MICHAEL>

How do I display whatever that gets submitted in a CSV File on an HTML Web Page by pulling it with php... I am kind of lost....?

You know it be nice if you can once in a while click Mark Solve on some of the threads you posted. It's just that sometimes you just double a same questions because you can't add something or can't modify it.

You need to used this function:

http://us3.php.net/manual/en/function.fgetcsv.php

to pull the csv file on to the webpage.

I'm sorry, I understand that I tend to forget to hit the mark solved button... I will make a moment to add a few mark solved articles... but some of those are still open and need answering...

So, through that link... i should use this?:

<?php
$row = 1;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
}
?>

Thanks for your response

Well... I got it to work but when I placed numbering on it... it counted oddly... It counted: 1 2 4 6 9 12 15 and so on... I am going to investigate this and come back to zthis thread...

*this...

I spelled "this" wrong...

Member Avatar

LastMitch

@<MICHAEL>

Well... I got it to work but when I placed numbering on it... it counted oddly... It counted: 1 2 4 6 9 12 15 and so on... I am going to investigate this and come back to zthis thread.

OK, that's neat you got it working. The odd number might have to do with the cvs file. Did you put this 0; in front of all your data:

0;Posting;a
1;Whiz;s

I had this... but this could be what you mean by having a 0...

$tdcount = 0;

This is just a variable... but it may not mean much...

Member Avatar

LastMitch

@<MICHAEL>

$tdcount = 0;

No, that's not what I meant. I'm not quite sure where you got that code? You know you post a lot of threads. It's bit hard to remember what code you post or someone post a code on your thread.

Post the code so I can see what you are doing.

Read this:

Basic rules and examples

http://en.wikipedia.org/wiki/Comma-separated_values

it will show an example what I mention.