Reading Data From .CSV Files

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Post by Oleg Butuzov » Sat Jun 21, 2003 10:17 pm

getcvs works unperfect... sorry.

try to use explode or regular expresion for this.

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Sun Jun 22, 2003 8:32 am

Code: Select all

<?php
$fp=fopen("./database.csv","r");
while($data = fgetcsv ($fp, 1024, ","))
  {
  echo ($data[11] == $country) ? $data[1]. ' from ' .$data[11]. '<br />' : '' ;
  }
fclose($fp);
?>


you were using an assignment = in your if clause ( if(a=b) should be if(a==b)) and muddling a few vars around.

try the above anyway.

subnote: be sure to set $country to some value somewhere

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest