Jump to content

[SOLVED] load data infile


jakebur01

Recommended Posts

I am getting this error.

 

PHP Fatal error: Call to undefined function load_file_data() in C:\Inetpub\mysite\ssc_dataupload.php on line 34

 

here is the code:

$source_file_01 = "C://Inetpub/mysite/text/test.txt";
$destination_table_01 = "item";

//call to function
$luinfo = load_file_data($source_file_01, $destination_table_01);

// load data infile
// EMPTY TABLE BEFORE load
function load_file_data($source_file, $destable){

// Connect to the DB
$db_host = "localhost";
$db_user = "aaaa";
$db_pass = "aaaa";
$db_name = "aaaa";

$connect = @mysql_connect($db_host,$db_user,$db_pass);
@mysql_select_db($db_name);

// Empty table
$query = "DELETE FROM $db_name.$destable";
$result = mysql_query($query);

// do the data import
$query = "load data infile \"$source_file\" INTO TABLE $destable FIELDS TERMINATED BY '@'";

$result = mysql_db_query($db_name, $query, $connect)
or die("Couldn't execute query"); 
} 

Link to comment
https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/
Share on other sites

sorry, I meant *data not going in.

 

I fixed the script, I should have looked at it more closely before posting here so quickly. I found that on the internet and was really paying attention when manipulating it.

 

but now, i get this error:

 

Access denied for user 'jakebur01'@'localhost' (using password: YES)

 

how do I view my mysql permissions?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.