Mj1992
Mj1992

Reputation: 3504

Load data infile mysql not working in php script

I've this code to load data from text file into MySQL table. but I don't know why it is not working.

My php code:

self::$mysqliStmts=DBCon::ConnectToDB();
self::$data=DBCon::QueryDataWithoutProcessing("LOAD DATA INFILE 'C:\wamp\www\php\gagster\Others\friends.txt' INTO TABLE gagster.friends");      
mysqli_close(self::$mysqliStmts);

public static function QueryDataWithoutProcessing($query)
{
    self::ConnectToDB();
    self::$QueryResult=self::$mysqli->query("$query");      //process query
    mysqli_close(self::$mysqli);                            //close connection
    return self::$QueryResult;                              //return result 
}

When I write any other query in place of this query it works fine.Only this query is causing problems.

I ran the query in mysql workbench and there also it is working fine.

Upvotes: 0

Views: 368

Answers (1)

Daniel
Daniel

Reputation: 3806

"Windows path names are specified using forward slashes rather than backslashes. If you do use backslashes, you must double them." - http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Upvotes: 3

Related Questions