RE: Re: No data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1 User uploads file
2 program reads array
3 program creates a table called $memberID.$filename  if not exist
($filename is column)
4 program uploads data into table/column

I am messed up at #2 for some reason so #4 fails.
All 'key's appear to be in their correct place so I don't know. 

https://gist.github.com/3184155   <- code

array(1) { ["file"]=> array(5) { ["name"]=> string(14) "emailsTest.txt"
["type"]=> string(10) "text/plain" ["tmp_name"]=> string(14)
"/tmp/php7wxmEI" ["error"]=> int(0) ["size"]=> int(61) } } array(1) {
["file"]=> array(5) { ["name"]=> string(14) "emailsTest.txt" ["type"]=>
string(10) "text/plain" ["tmp_name"]=> string(14) "/tmp/php7wxmEI"
["error"]=> int(0) ["size"]=> int(61) } } string(165) "	 LOAD DATA LOCAL
INFILE '/tmp/php7wxmEI' INTO TABLE `3` FIELDS TERMINATED BY ',' OPTIONALLY
ENCLOSED BY '\'' LINES TERMINATED BY "\r\n" IGNORE 1 LINES" $sqlDuplicate
column name 'emailsTest.txt'


mysql> SHOW CREATE TABLE `3`;
+-------+-------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-----------------------------+
| Table | Create Table
|
+-------+-------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-----------------------------+
| 3     | CREATE TABLE `3` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `Array` varchar(60) DEFAULT NULL,
  `emailsTest.txt` varchar(60) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 |
+-------+-------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-----------------------------+
1 row in set (0.00 sec)





mysql> SELECT * FROM `3`;
Empty set (0.00 sec)





Brad Sumrall
NYCTelecomm.com
212 444-2996


-----Original Message-----
From: Jim Giner [mailto:jim.giner@xxxxxxxxxxxxxxxxxx] 
Sent: Thursday, July 26, 2012 10:55 AM
To: php-db@xxxxxxxxxxxxx
Subject:  Re: No data?

Are you any closer to getting your solution to work yet?  If not, could I
ask for the general concept again?  From what I can remember, You want to
allow a user to upload a csv file which you will then put into a sql table.
Additionally your code seems to be creating a new table for each file
uploaded.  Are these csv files each unique, ie, do they have different data
contents as in different "fields" of information?  Or do they all supply the
same information in the same format.  ( Hope you get what I mean.)  If each
file is different and each table is going to have different column names,
how are these tables then going to be processed? 
You'll need different handlers for each table, no?  And if each file is the
same then why not put the data into separate records of the same table?

As I mentioned before - it sure seems like you are trying to do too many
things at once.  Concentrate on getting the client file onto the server with
a unique name and THEN work on the next problem of putting it into a table
if you must.

And if I am just entirely off-base, tell me to buzz off and I will leave
this thread alone.  I just hate to see someone struggling for so many days
on something that seems so simple to me.

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


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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux