Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

Apparent EOL Issue with PHP/MySQL (1 reply)

$
0
0
I have installed WAMP on a Windows 2008 R2 server. Running Apache 2.4.29, PHP 7.2.18, MySQL 5.7.26. Copied PHP scripts from a Linux server. Have successfully gotten a couple to work, including connecting to MySQL and MS SQL databases.

The problem I am having is with importing a CSV file. Overcame the security issue. I can create the file using this command:

$FileOut = $row->sEmployeeID.",".$row->sLastName.",". $row->sFirstName.",". $row->sTitle.",".$newHireDate."\r\n";

When I try to import the file into the MySQL table using:

$query="load data infile 'C:/wamp64/tmp/PicnicEmp.csv' into table PicnicEmp fields terminated by ',' lines terminated by '\r\n'";

it fails.

Here's where it gets weird. By printing the query I can see that the query is:

load data infile 'C:/wamp64/tmp/PicnicEmp.csv' into table PicnicEmp fields terminated by ',' lines terminated by ' '

Notice the lack of the \r\n.

In phpMyAdmin, if I run the query as shown above, it fails. Get a #1261 - Row 1 doesn't contain data for all columns which isn't true.

If I edit the statement and reinsert the \r\n, it works perfectly. It appears to me to be a Windows issue but I can't find any solutions anywhere. Any one have any suggestions?

Viewing all articles
Browse latest Browse all 3177

Trending Articles