Jump to content

[SOLVED] Parse error: syntax error, unexpected $end in C:\wamp\www\Villages.php on line 5


Recommended Posts

Hello all,

 

I am recieving this error and i dont know how to overcome this situation.  I am trying to download data given out by a game website i play.  Tribalwars.

 

set_time_limit(300);

$dbhost = 'Hidden';
$dbuser = 'Hidden';
$dbpass = 'Hidden';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'tribalwars';
mysql_select_db($dbname) or die('Error selecting database');



$lines = gzfile('http://en7.tribalwars.net/map/village.txt.gz');
if(!is_array($lines)) die("File could not be opened"); 
foreach($lines as $line) {
list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
$name = urldecode($name);

$name = addslashes($name);
$sql = "INSERT INTO village SET id='$id', name='$name', x='$x', y='$y', player='$player', points='$points', rank='$rank'";
mysql_query($sql);

?>

 

I know this error is caused by haveing an open curly bracket but that is the code.    The code is located here http://en7.tribalwars.net/help2.php?article=map_data

 

Is there anywhere the curly bracket should go or is there a way to get round this?

 

Thanks all

 

Best Regards

 

-Glen

It should go where it's missing.

 

Sift through it and find where it's missing at, which is probably right before the ?> end tag.

 

 

Is there anywhere the curly bracket should go or is there a way to get round this?

 

Thanks all

 

Best Regards

 

-Glen

Glen, Can you click Solved please

 

 

Why?

 

try removing '$conn ='

 

on the line

 

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

 

LOL php.ajax.coder post was updated after wildteen88 post and revraz comment

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.