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'>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<br>
<br>
<hr>
<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'>
</form>
</body>
</html>
import.php:
<?php
$db=mysql_connect("localhost", "root", "password") or die(mysql_error());
$dname="test";
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
Subject
Written By
Posted
upload csv file to mysql using php
February 23, 2010 01:45PM
February 25, 2010 08:00PM
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.