0

I created a script where we add 'playlists'. In MySQL is something like:

Cod: 18, Playlist: teste, Looptande: 1, Starttime: 09:00
Cod: 19, Playlist: teste2, Looptande: 0, Starttime: 10:00

I'm trying to generate an XML in the following format:

<playlist loopatend="1" shuffle="inherit">teste</playlist>
<calendar starttime="09:00">

Second:

<playlist loopatend="0" shuffle="inherit">teste2</playlist>
<calendar starttime="10:00">

I was wondering if it detects that the number of playlists and repeat correctly as above.

I'm trying to do this:

$qtd_ag = 0;

$sql_ag = mysql_query("SELECT * FROM event where codigo_stm = '".$dados_stm["codigo"]."' ORDER by playlist");
while ($dados_ag = mysql_fetch_array($sql_ag)) {

    $ag_config_autodj .= "playlistfilename_".$qtd_ag."=".$dados_ag["playlist"]."\n";
    $ag_config_autodj .= "playlistfilepath_".$qtd_ag."=/home/streaming/playlists/".$dados_stm["porta"]."-".$dados_ag["playlist"].".pls\n";
    $ag_config_calendar = array ("loopatend" => $dados_ag["loopatend"], "priority" => $dados_ag["priority"], "playlist" => $dados_ag["playlist"], "starttime" => $dados_ag["starttime"], "duration" => $dados_ag["duration"], "repeat" => $dados_ag["repeatc"], "startdate" => $dados_ag["startdate"], "enddate" => $dados_ag["enddate"], "shuffle" => $dados_ag["shuffle"]);

    $qtd_ag++;
}

$config_calendar = gerar_calendar_autodj($dados_stm["porta"],$djs_config_calendar,$ag_config_calendar);                 

$ssh->enviar_arquivo("../temp/".$config_autodj."","/home/streaming/configs/".$config_autodj."",0777);
$ssh->enviar_arquivo("../temp/".$config_calendar."","/home/streaming/configs/".$config_calendar."",0777);

unlink("../temp/".$config_autodj."");
unlink("../temp/".$config_calendar."");

Function second: (function.php) I can not paste the code here, I always fumble excuse me please, but I need help. then will the print:

print

Thus it creates the XML but goes wrong with values ​​that do not correspond to the database:

<playlist loopatend="0" shuffle="0" priority="0" >array</playlist>
<calendar starttime="0" endtime="" repeat="128">
<playlist loopatend="0" shuffle="0" priority="0" >array</playlist>
<calendar starttime="0" endtime="" repeat="128">
Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
Cassiano José
  • 139
  • 1
  • 6
  • I highly recommend NOT generating XML by hand. See http://stackoverflow.com/a/487282/421752 for simple example. – Im0rtality Feb 08 '14 at 16:45

1 Answers1

0

In image you are using $$event[...]. I think that should be $event[...].

Im0rtality
  • 3,463
  • 3
  • 31
  • 41