473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

php import to table failing

(I am sorry if this is the wrong group for this posting, I cant find a
group on usenet for phpmyadmin, but maybe someone would be nice enough
to answer me anyway....)

I need to import data into a simple table The table has three fields.
The first is an auto increment value, the second the current time and
date (the 14 character version), and a field with some data.

This works okay in SQL mode
INSERT INTO all_epst VALUES ('',NOW(),'infotest1');
INSERT INTO all_epst VALUES ('',NOW(),'infotest2');

Using phpmyadmin I want to import this data from a csv file rather
than the workaround of creating sql script

Trouble is I cant get "current timestamp" to work. When I click on
import in phpmyadmin I can choose "csv" or "csv mha"
I try csv and set
row end to ;
field surround to '
field seperator to ,

The txt file for csv import contains
'',NOW(),'infotest1';'',NOW(),'infotest2';

It imports the data and gives me the autoincrement value but the time
stamp is left as 0000-00-00 00:00:00

Feedback:
INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest1'
)

INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest2'
)

I tried another txt file with
'','','infotest1';'','','infotest2';
Again, it imports the data and gives me the autoincrement value but
the time stamp is left as 0000-00-00 00:00:00
VALUES (
'', '', 'infotest1'
)
INSERT INTO `all_epst`
VALUES (
'', '', 'infotest2'
)

Note that the tabel is correctly structered with "CURRENT_TIMESTAMP"
as the default. The attribute ("ON UPDATE CURRENT_TIMESTAMP" is not
applicable as I am adding new values, but is set anyway.)

What am I missing? How do I import with a csv text file using
phpmyadmin?

Any help greatfully appreciated
Garry Jones
Sweden
Feb 24 '08 #1
2 2217

"GarryJones" <mo****@algonet.sewrote in message
news:52**********************************@u69g2000 hse.googlegroups.com...
(I am sorry if this is the wrong group for this posting, I cant find a
group on usenet for phpmyadmin, but maybe someone would be nice enough
to answer me anyway....)

I need to import data into a simple table The table has three fields.
The first is an auto increment value, the second the current time and
date (the 14 character version), and a field with some data.

This works okay in SQL mode
INSERT INTO all_epst VALUES ('',NOW(),'infotest1');
INSERT INTO all_epst VALUES ('',NOW(),'infotest2');

Using phpmyadmin I want to import this data from a csv file rather
than the workaround of creating sql script

Trouble is I cant get "current timestamp" to work. When I click on
import in phpmyadmin I can choose "csv" or "csv mha"
I try csv and set
row end to ;
field surround to '
field seperator to ,

The txt file for csv import contains
'',NOW(),'infotest1';'',NOW(),'infotest2';

It imports the data and gives me the autoincrement value but the time
stamp is left as 0000-00-00 00:00:00

Feedback:
INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest1'
)

INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest2'
)

I tried another txt file with
'','','infotest1';'','','infotest2';
Again, it imports the data and gives me the autoincrement value but
the time stamp is left as 0000-00-00 00:00:00
VALUES (
'', '', 'infotest1'
)
INSERT INTO `all_epst`
VALUES (
'', '', 'infotest2'
)

Note that the tabel is correctly structered with "CURRENT_TIMESTAMP"
as the default. The attribute ("ON UPDATE CURRENT_TIMESTAMP" is not
applicable as I am adding new values, but is set anyway.)

What am I missing? How do I import with a csv text file using
phpmyadmin?

Any help greatfully appreciated
Garry Jones
Sweden
That's hard to figure out second-hand. My best suggestion is to eliminate
the "field surround" element, which you shouldn't need as long as the field
doesn't contain a comma. The feedback you got shows value 'NOW()', but
what you need (I think) is NOW() without single quotes around it. So I
suspect the field surround is supplying single quotes and then mysql is
reading it as a string rather than a function.

You also might try setting a default to NOW() instead of just relying on the
phpmydamin checkbox.

Another suggestion is to check the encoding of your source.

Feb 24 '08 #2
GarryJones wrote:
(I am sorry if this is the wrong group for this posting, I cant find a
group on usenet for phpmyadmin, but maybe someone would be nice enough
to answer me anyway....)

I need to import data into a simple table The table has three fields.
The first is an auto increment value, the second the current time and
date (the 14 character version), and a field with some data.

This works okay in SQL mode
INSERT INTO all_epst VALUES ('',NOW(),'infotest1');
INSERT INTO all_epst VALUES ('',NOW(),'infotest2');

Using phpmyadmin I want to import this data from a csv file rather
than the workaround of creating sql script

Trouble is I cant get "current timestamp" to work. When I click on
import in phpmyadmin I can choose "csv" or "csv mha"
I try csv and set
row end to ;
field surround to '
field seperator to ,

The txt file for csv import contains
'',NOW(),'infotest1';'',NOW(),'infotest2';

It imports the data and gives me the autoincrement value but the time
stamp is left as 0000-00-00 00:00:00

Feedback:
INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest1'
)

INSERT INTO `all_epst`
VALUES (
'', 'NOW()', 'infotest2'
)

I tried another txt file with
'','','infotest1';'','','infotest2';
Again, it imports the data and gives me the autoincrement value but
the time stamp is left as 0000-00-00 00:00:00
VALUES (
'', '', 'infotest1'
)
INSERT INTO `all_epst`
VALUES (
'', '', 'infotest2'
)

Note that the tabel is correctly structered with "CURRENT_TIMESTAMP"
as the default. The attribute ("ON UPDATE CURRENT_TIMESTAMP" is not
applicable as I am adding new values, but is set anyway.)

What am I missing? How do I import with a csv text file using
phpmyadmin?

Any help greatfully appreciated
Garry Jones
Sweden
You're right - phpMyAdmin isn't supported on usenet. They have their
own forums on sourceforge.

That's where you should be asking.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Feb 24 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
39
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
4
by: news | last post by:
Our production database in an exported textfil runs about 60 MB. Compressed that's about 9 MB. I'm trying to import the export into another machine running FC3 and mySQL 11.18, and it appears as...
9
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with...
1
by: Juris Krumins | last post by:
Couple a weeks ago (19.08.03 Subject: Temporaty tables) I've posted message with question about errors I'm getting while using create temporaty table command. So I'm start digging in src code as...
3
by: Neter Smith | last post by:
I have run into a problem when trying to import a WSDL reference under VS 2003 and 1.1 of the framework. It appears as if it is in the generation of the proxy that things are failing. When I...
3
by: laredotornado | last post by:
Hello, My hosting company has MySQL 5 and so do I on my local Fedora Core 5 Linux machine. However, when I import a dump file from their enviornment into mine, I get this error ERROR 1064...
11
by: David Abrahams | last post by:
I'm pretty comfortable with Python, but recently I'm constantly finding mysterious issues with import. For example, looking at ...
1
by: grbgooglefan | last post by:
I am importing cStringIO module in my PythonC++ embedded program. The import is failing with the following error: ImportError: /usr/lib/python2.3/lib-dynload/cStringIO.so: undefined symbol:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.