View Single Post
Old 10-30-2009, 08:16 PM   #11 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

That data is different to what you posted earlier and is indeed a normal CSV file. How are you parsing the data? fgetcsv should have no problem with it at all.

Does this work?

PHP Code:
<?php

$fp   
fopen("mycsvfile.txt","r");
$rows = array();
while ((
$row fgetcsv($fp)) !== FALSE) {
    
$rows[] = $row;
}
fclose($fp);
?>
<table>
 <thead>
  <tr>
   <td>Name</td>
   <td>ID</td>
  </tr>
 </thead>
 <tbody>
<?php foreach ($rows as $row) : list($name$id) = $row?>
  <tr>
   <td><?php echo $name?></td>
   <td><?php echo $id?></td>
  </tr>
<?php endforeach; ?>
 </tbody>
</table>
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
Dave (10-31-2009)