Problems with strings containing
Posted on 16th Feb 2014 07:03 pm by admin

Hey all,

I have encountered something strange in a script. I am trying to write an XML header and then fill in the file:
Code: $xmlFile = "fetchableData.xml";
Did you know?Explore Trending and Topic pages for more stories like this.
$fh = fopen($xmlFile, 'r+');

$housingData = updateHousingAndReturnXML();
$xmlData = '<?xml version="1.0" ?>'.$housingData;

// echo $xmlData;

fwrite($fh,$xmlData);
fclose($fh);
This code fills the file with the contents of $housingData, but <?xml version="1.0" ?> is not added. If I break up <? it will add it but then I get errors when parsing the XML.

Echoing the string also doesn't work with <?.

I guess what is happening is that the string is getting parsed by the PHP engine for some reason. Escaping <? doesn't work.

I am assuming I am missing something basic. But the manual doesn't say anything about <? being parsed in strings.

Help?

Thanks

No comments posted yet

Your Answer:

Login to answer
263 Like 48 Dislike
Previous forums Next forums
Other forums

Getting rid of quotes when printing data
Hi Guys, I use the filter_var FILTER_SANITIZE_STRING to filter the textarea input. The function esca

Ball movement
I want to move a ball from one point to another and it should hit a group of balls at the other end

Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Help with writing "$" with fopen
I just can't get my syntax correct. Could someone help me please? I am trying to write a connect fil

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

Access database inside of a validation class
Hello,

For quite some time, I have been using functions to validate form input and access the

array & querys help/advice.
Ok so here goes , I have a mysql database and basically here's what I need to do.

// foreach

Format timestamp from mysql
When I tried this:
Code: date("m/d/Y H:i A", $row['timestamp'])
I got 12/31/1969 18:

MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos

MID(networkset.networkid, 3, 3) AS &q

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash