Hi all
I keep getting
Parse error: parse error, expecting `']'' on line 43
here is my code
<?
$paste = "Content: Planetarion galaxy listing (sorted by x, y)
Author: vish@planetarion.com
Version: 1.01 (2002-03-19 09:00:00 ISO)
Date: 2002-06-09 19:04:55 ISO
Tick: 130
Separator: ' '
Format: X Y \"GalaxyName\" Score
1 1 \"Planetarion HQ\" 118979
1 2 \"Neighbours[!]\" 1518397
1 3 \"Name one\" 1300873
1 4 \"Uncritical Diplomats [!]\" 394688
EOF" ;
$paste = str_replace("Content: Planetarion galaxy listing (sorted by x, y)\n","",$paste);
$paste = str_replace("Author: vish@planetarion.com\n","",$paste);
if (ereg ("([a-z]{7}): ([0-9]{1,2}).([0-9]{1,2}) (([0-9]{4})-([0-9]{2})-([0-9]{2})) ([0-9]{2})🙁[0-9]{2})🙁[0-9]{2}) ISO)\n", $paste, $redo)) {
$paste = "";
}
if (ereg ("([a-z]{4}): ([0-9]{1,2,3,4,5}\n", $paste, $redo)) {
$paste = "";
}
$paste = str_replace("EOF","",$paste);
$paste = str_replace("Separator: \' \'","",$paste);
$paste = str_replace("Format: X Y \"GalaxyName\" Score","",$paste);
$paste = str_replace(" ","_",$paste);
$paste = str_replace("\"","",$paste);
$paste = explode(" ", $paste);
$db = mysql_connect("localhost","","");
mysql_select_db("pasite",$db);
for($i=0;$i<=sizeof($paste);$i++) {
for($k=$i;$k<=$i+4;$k++) {
$new = "$paste[$k] $paste[$k++] $paste[$k+2] $paste[$k+3]" ;
list($x, $y, $name, $score) = split('[ ]', $new);
mysql_query("INSERT INTO universe_gals VALUES ($x,$y,'$name',$score)");
}
}
?>
line 43 is this bit in the FOR
$new = "$paste[$k] $paste[$k++] $paste[$k+2] $paste[$k+3]" ;
Ive tried loads of things,
like
$new = 'paste[$k]' + 'paste[$k++]' + 'paste[$k+2]' + '$paste[$k+3]' ;
and such like, but when I do that i get errors in the str_replace's ..
can anyone spot the problem or problems if there are more please?
any help would be really helpful, as im out of ideas!
hehe! oh well
Regards
Ben