0

here is my code. I really want to echo a specific cell from my CSV file without any MySQL stuff..

if (($handle = fopen("ebbe.csv", "r")) !== FALSE) {
    # Set the parent multidimensional array key to 0.
    $nn = 0;
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        # Count the total keys in the row.
        $c = count($data);
        # Populate the multidimensional array.
        for ($x=0;$x<$c;$x++)
        {
            $csvarray[$nn][$x] = $data[$x];
            //echo $data[$x] . '<br>';
        }
        $nn++;
    }
    fclose($handle);
}

The data is in the $csvarray multidimensional array, but i can't write out a specific one. I tried this, but it said undefined offset on 2.

echo $csvarray[1][2];

Please help me! (yes, im a php noob :( )

4

1 回答 1

0

尝试

 echo '<pre>';
 print_r($csvarray);
 echo '</pre>';

它将显示数组的内容。现在您已经对阵列进行了可视化展示,您应该能够看到需要走多远。

于 2013-07-07T17:42:33.873 回答