RE: Re: No data?

"Brad" <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <001a01cd6bb6$120b4200$3621c600$@com>
No, it did not work.

mysql> show tables;
+--------------------+
| Tables_in_mailList |
+--------------------+
| testBook1csv       |
+--------------------+
1 row in set (0.00 sec)

mysql> select * from `testBook1csv`;
+----+--------+
| id | field0 |
+----+--------+
|  1 | NULL   |
|  2 | NULL   |
|  3 | NULL   |
|  4 | NULL   |
|  5 | NULL   |
|  6 | NULL   |
+----+--------+
6 rows in set (0.00 sec)



file upload example

$_FILES

  array(1) {
  ["userfile"]=>
  array(5) {
    ["name"]=>
    string(13) "testBook1.csv"
    ["type"]=>
    string(24) "application/octet-stream"
    ["tmp_name"]=>
    string(14) "/tmp/phpiaW23p"
    ["error"]=>
    int(0)
    ["size"]=>
    int(102)
  }
}
ls -l /tmp/phpiaW23p

-rw------- 1 apache apache 102 Jul 27 00:02 /tmp/phpiaW23p
$sql for create table

string(110) "create table if not exists `testBook1csv` (id integer not null auto_increment primary key, field0 varchar(50))"
$sql for load data

string(142) "load data local infile '/tmp/phpiaW23p' into table `testBook1csv` fields terminated by ',' optionally enclosed by '"' lines terminated by '\n'"
Verify data contents

Table testBook1csv

string(28) "select * from `testBook1csv`"
$sql=
data

array(2) {
  [0]=>
  string(1) "1"
  [1]=>
  NULL
}
array(2) {
  [0]=>
  string(1) "2"
  [1]=>
  NULL
}
array(2) {
  [0]=>
  string(1) "3"
  [1]=>
  NULL
}
array(2) {
  [0]=>
  string(1) "4"
  [1]=>
  NULL
}
array(2) {
  [0]=>
  string(1) "5"
  [1]=>
  NULL
}
array(2) {
  [0]=>
  string(1) "6"
  [1]=>
  NULL
}

-----Original Message-----
From: tamouse mailing lists [mailto:[email protected]] 
Sent: Thursday, July 26, 2012 11:20 PM
To: Brad
Cc: [email protected]; [email protected]
Subject: Re: [PHP-DB] Re: No data?

Brad, do take a look at http://pastie.org/4340383 It does work.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.