I need some help with my PHP, I'm generating to make the xml output.

In the xml output, I can see that I'm using double quotes but i want to use the single quotes.

I want to add the single quotes in the <programme channel= tag to make it like this:

<programme channel='101 ABC FAMILY' start='20140504113000' stop='20140504131000'>

On mine the output show like this:

<programme channel="101 ABC FAMILY" start="20140504113000" stop="20140504131000">

You will see like this:

http://oi57.tinypic.com/2058hs3.jpg

When I open the source code, I can see that I have got the single quotes.

<programme channel='101 ABC FAMILY' start='2014-05-04' stop='2014-05-05'></programme>

The problem may lie in this line:

$xml .= "
      <programme channel='$my_id $channel' start='$stoptime' stop='$starttime'>";

Here is the code:

<?php
header("Content-Type: text/xml");
$my_id = '101';
$channel = 'ABC FAMILY';
$starttime = '2014-05-04';
$stoptime = '2014-05-05';

$xml .= "
  <programme channel='" . $my_id. " " . $channel . "' start='" . $starttime . "' stop='" . $stoptime . "'>";

//$xml .= "<programme channel='".$channel."' start='".$starttime."'>";
//$xml .= "<programme channel='$my_id $channel' start='$starttime' stop='$stoptime'>";

$xml .= '</programme>';

echo $xml;
$handle = fopen("myChannel.xml", "w"); 
fwrite ($handle, $xml);
?>

How I can see the single quotes in the xml tree when I'm generating the xml?

Change line 8, swap the single and double quotes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.