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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.