MySQL Forums
Forum List  »  PHP

upload csv file to mysql using php
Posted by: vani p
Date: February 23, 2010 01:45PM

Hi all,
I am trying to upload a csv file to mysql.This is what i am tryhing to do..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body background="../images/darkgray_black_bg.jpg" text="#ffffff">
<basefont face='courier new'>
<form enctype='multipart/form-data' action='import.php' method='post'>
<input type="hidden" name="MAX_FILE_SIZE" value="100000000">
Import a CSV File: <input type='file' name='csvfile'><br>
<input type='submit' value='import'>
<input type='hidden' value='<?=$_REQUEST['eid']?>' name='eid'>



$db=mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db($dname)or die(mysql_error());
$sqlstatement="LOAD DATA INFILE '_$FILES[file][tmp_name]' into TABLE table05 FIELDS TERMINATED BY ',' (company,phone1,phone2)" ;
mysql_query($sqlstatement) or die(mysql_error());;
echo "it is done!";

it throws an error: test\.tmp_name not found errorcode 220..PLease help

Options: ReplyQuote

Written By
upload csv file to mysql using php
February 23, 2010 01:45PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.