[SOLVED]-else statement.
Posted: Fri Jan 30, 2004 2:11 pm
Oke.. some of you might have seen this from database.. however its no longer a database question i guess.
i made some changes in the script
which gave me this error.
So now i am stuck on how to change the Else statement in line 46
compleet script
How should i do this? any suggestions![/i]
i made some changes in the script
Code: Select all
while ($row = mysql_fetch_array($result))
// before this was if ($row = mysql_fetch_array($result))
// which cuases it not to fetch all rowsParse error: parse error, unexpected T_ELSE in xml.php on line 46
So now i am stuck on how to change the Else statement in line 46
compleet script
Code: Select all
$result = mysql_query($query) or die (mysql_error());
$num = mysql_num_rows($result);
if ($num != 0)
{
$file= fopen("resulta.xml", "w");
$_xml ="<?xml version="1.0" encoding="UTF-8"?>\r\n";
$_xml .="<Caudat_xml>\r\n";
while ($rows = mysql_fetch_array($result))
{
$_xml .="\t<num_paquete>="" . $rows["Paqnr"] . "">\r\n";$_xml .="\t</num_paquete>\r\n";
$_xml .="\t<empresa>="" . $rows["Empresa"] . "">\r\n";$_xml .="\t</empresa>\r\n";
$_xml .="\t<codigo>="" . $rows["Codigo"] . "">\r\n";$_xml .="\t</codigo>\r\n";
$_xml .="\t<envio>="" . $rows["Envio"] . "">\r\n";$_xml .="\t</envio>\r\n";
$_xml .="\t<desde>="" . $rows["Desde"] . "">\r\n";$_xml .="\t</desde>\r\n";
$_xml .="\t<peso_total>="" . $rows["Peso_Total"] . "">\r\n";$_xml .="\t</peso_total>\r\n";
$_xml .="\t<peso>="" . $rows["Peso"] . "">\r\n";$_xml .="\t</peso>\r\n";
$_xml .="\t<valor>="" . $rows["Valor"] . "">\r\n";$_xml .="\t</valor>\r\n";
$_xml .="\t<codigo_env>="" . $rows["Codigo_Env"] . "">\r\n";$_xml .="\t</codigo_env>\r\n";
$_xml .="\t<informacion>="" . $rows["Information"] . "">\r\n";$_xml .="\t</informacion>\r\n";
//$_xml .="\t<dato="" .$hoy. "">\r\n";$_xml .="\t</dato>\r\n";
}
else //-------------> line 46
{
$_xml .="\t<Query_Empty>="No Resulta">\r\n";
$_xml .="\t</Query_Empty>\r\n";
}
}
$_xml .="</Caudat_xml>";
fwrite($file, $_xml);
fclose($file);
echo "XML formato list. <a href="resulta.xml">Por Aqui el formato XML.</a>";
?>