tags:

views:

23

answers:

1

In my PHP code I have this:

$filename = 'data.xml';
$xml = file_get_contents($filename);
$data = simplexml_load_string($xml);
$variable = "";
foreach ($data->file_info as $record)
{
    $id1 = $record['id1'];
    $id2 = $record['id2'];
}

And it works perfectly fine on the web server, but when trying to view it locally (using xampp) I get the following output at the top of my pgae:

file_info as $record)
{
    $id1 = $record['id1'];
    $id2 = $record['id2'];
}

(followed by another 100 or so lines of PHP)

Not sure if it would make a difference, the web server it works on is running linux, and I am trying to view it on windows using xampp)

A: 

Make sure short_open_tag is set to on in php.ini / change <? to <?php. If that doesn't do it, check apache's logs to see what is going on. Also check if php is defined as the handler for .php files in your httpd.conf.

nc3b
Aah you've got me. I always use <?php aside from this one time. Every other part of the script uses <?php, to think this has stumped me for so long.
Hintswen