heres the view code:
# setup SQL statement
$SQL = " SELECT * FROM ".$ddgnews." ORDER BY id ";
# execute SQL statement
$retid = mysql_db_query($db, "$SQL", $cid);
# check for errors
if (!$retid) { echo( mysql_error()); }
else {
# display results
echo ("News Archive<br>");
while ($row = mysql_fetch_array($retid)) {
$date = $row["date"];
$id = $row["id"];
$text = $row["text"];
echo ("<table border=1 cellpadding=1 cellspacing=1 bordercolor='#cccccc'>
<tr><td><b>ID:</b> ".$id."</td></tr>
<tr><td><b>Date:</b> ".$date."</td></tr>
<tr><td><b>Text:</b><br><textarea cols=40 rows=5 READONLY>".text."</textarea></td></tr>
</table><br>");
}
echo ("<br>".$back."");
}
xml code is here:
<?
require ("../config/connect.php");
$query = "select * from ".$ddgnews."";
$result = mysql_query($query, $cid) or die("Could not complete database query.");
$num = mysql_num_rows($result);
$filename = "news.xml";
if ($num != 0) {
$file= fopen("".$filename."", "w");
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$_xml .="<news>\r\n";
while ($row = mysql_fetch_array($result)) {
if ($row["text"]){
$text = $row["text"];
$date = $row["date"];
$_xml .="\t<newsNode dateVar=".$date.">".$text."></newsNode>\r\n";
} else {
$_xml .="\t<newsNode>No News Data Entries Found</newsNode>\r\n";
}
}
$_xml .="</news>";
fwrite($file, $_xml);
fclose($file);
echo "XML has been written/updated. <a href='".$filename."' target='_blank'>View the XML.</a>";
} else {
echo "No Records found.. XML File not updated.";
}
?>
do you know of a way to limit a loop to a number of times?