> //<?php
> 
> mysql_connect (localhost, foouser, foologin);
> 
> mysql_select_db (footest1);
> 
> $csvfile = file("http://foo.com/foolist.csv";);
> 
> foreach($csvfile as $line_no => $datastring) {
>         $data = explode (",", $datastring);
>         $foo1 = $data[0];
>         $foo2 = $data[1];
>         $foo3 = $data[2];
>         $foo4 = $data[3];
>         $foo5 = $data[4];
>         $foo6 = $data[5];
>         $foo7 = $data[6];
> 
>         mysql_query ("INSERT INTO 'footable' (foo1, foo2, foo3, foo4, foo5, foo6, 
> foo7)
>                 VALUES '$foo1', '$foo2', '$foo3', '$foo4', '$foo5', '$foo6', 
> '$foo7')");
> }
> 
> //?>

try this

mysql_connect (localhost, foouser, foologin);

mysql_select_db (footest1);

$csvfile = file("http://foo.com/foolist.csv";);

while (($data = fgetcsv($csvfile, 1000, ",")) !== FALSE) {
       $foo1 = $data[0];
       $foo2 = $data[1];
       $foo3 = $data[2];
       $foo4 = $data[3];
       $foo5 = $data[4];
       $foo6 = $data[5];
       $foo7 = $data[6];

       mysql_query ("INSERT INTO 'footable' (foo1, foo2, foo3, foo4,
foo5, foo6, foo7)
               VALUES '$foo1', '$foo2', '$foo3', '$foo4', '$foo5',
'$foo6', '$foo7')");
}

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to