sp@rky13 Posted January 5, 2010 Share Posted January 5, 2010 So I'm doing this to import and unzip a text file: cd www/tw/data/9 && rm village.txt.gz ; wget http://en9.tribalwars.net/map/village.txt.gz && rm village.txt ; gunzip village.txt.gz And then to put it into a database I tried this but it failed: $connection = mysql_connect("*********","********","*********"); mysql_select_db("********", $con); mysql_query("TRUNCATE `village9`"); $load = mysql_query("LOAD DATA LOCAL INFILE '../data/9/village.txt' INTO TABLE `village9` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (id, name, x, y, owner, points, rank)"); if (!$load) { die('Invalid query: ' . mysql_error()); } Anyone see the problem? Quote Link to comment https://forums.phpfreaks.com/topic/187221-php-errors/ Share on other sites More sharing options...
oni-kun Posted January 5, 2010 Share Posted January 5, 2010 What is the error mysql_error() gives you? That'd be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/187221-php-errors/#findComment-988677 Share on other sites More sharing options...
sp@rky13 Posted January 5, 2010 Author Share Posted January 5, 2010 Im' doing it as a cron job and get this error: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: line 0: `$connection = mysql_connect("*********","********","*********"); mysql_select_db("********", $con); mysql_query("TRUNCATE `village9`"); $load = mysql_query("LOAD DATA LOCAL INFILE '../data/9/village.txt' INTO TABLE `village9` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (id, name, x, y, owner, points, rank)"); if (!$load) { die('Invalid query: ' . mysql_error()); } Quote Link to comment https://forums.phpfreaks.com/topic/187221-php-errors/#findComment-988682 Share on other sites More sharing options...
sp@rky13 Posted January 5, 2010 Author Share Posted January 5, 2010 I asked about this on my hosting's forum and got an answer quicker so it's solved Quote Link to comment https://forums.phpfreaks.com/topic/187221-php-errors/#findComment-988708 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.