我有用于导出到XML的代码ID PHP,我不知道,问题在哪里?
<?php
$data=mysql_query("SELECT * FROM ``");
while($zaznam=mysql_fetch_array($data)){
$select = "select * from `` WHERE ID=".$zaznam['ID']."";
$proved = mysql_query($select) or die ( mysql_error() );
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<Kurzy>\n";
for($x = 0 ; $x < mysql_num_rows($proved) ; $x++){
$row = mysql_fetch_assoc($proved);
$xml_output .= "\t<Kurz>\n";
$xml_output .= "\t</Kurz>\n";
}
$xml_output .= "</Kurzy>";
echo $xml_output;
?>
我的代码有时写错误,有时没有。哪里有问题?
答案 0 :(得分:0)
错过了最接近的while }
最后一行
$data=mysql_query("SELECT * FROM ``");
while($zaznam=mysql_fetch_array($data)){
$select = "select * from `` WHERE ID=".$zaznam['ID']."";
$proved = mysql_query($select) or die ( mysql_error() );
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<Kurzy>\n";
for($x = 0 ; $x < mysql_num_rows($proved) ; $x++){
$row = mysql_fetch_assoc($proved);
$xml_output .= "\t<Kurz>\n";
$xml_output .= "\t\n";
}
$xml_output .= "</Kurzy>";
echo $xml_output;
}
?>