I want to write a script to deal with csv file with more than 3 column, 
which can deal with two column.
How do I use foreach?

The script below is usual script to deal with two column.

$fp = fopen($_FILES['upfile']['tmp_name'], "rt");
$filename = hoge;
while ($data = fgetcsv($fp, 10000)) {
foreach ($data as $value1 => $value2){
$sql = "INSERT INTO customer_csv (name, value1, value2) VALUES ($hoge, 
$value1, $value2)";
mysql_query($sql);
}
}







Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to