jakebur01 Posted January 30, 2008 Share Posted January 30, 2008 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"); } Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/ Share on other sites More sharing options...
PHP Monkeh Posted January 30, 2008 Share Posted January 30, 2008 That's simply because you've called it before the function has even been created. Put your function at the top of the page. Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453485 Share on other sites More sharing options...
jakebur01 Posted January 30, 2008 Author Share Posted January 30, 2008 ok, now I'm not getting the error anymore but the data is not going on. I still have something screwed up in the script. Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453496 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 What does the data is not going on mean? Your load_file_data() doesn't return anything, maybe thats your issue? Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453505 Share on other sites More sharing options...
jakebur01 Posted January 30, 2008 Author Share Posted January 30, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453527 Share on other sites More sharing options...
PHP Monkeh Posted January 30, 2008 Share Posted January 30, 2008 It depends, if you're on your own localhost your default access is probably going to be "root" with no password. Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453531 Share on other sites More sharing options...
jakebur01 Posted January 30, 2008 Author Share Posted January 30, 2008 the guy whos server i use set me up a mysql account and database. I use phpmyadmin usually to view things. root with no pass does not work. Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453538 Share on other sites More sharing options...
PHP Monkeh Posted January 30, 2008 Share Posted January 30, 2008 Ask him what the username & password is to connect to the database, or ask him to add a user to it so you can gain access. Then just put those values in to your script Quote Link to comment https://forums.phpfreaks.com/topic/88578-solved-load-data-infile/#findComment-453626 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.