junior84
04-16-2007, 10:52 PM
hello
[QUOTE]<?php
$db_name = "wilkiesh_newone";
$connection = mysql_connect("localhost", "wilkiesh_johnboy", "johnboy") or die ("**** off");
$table_name = "name";
$db = mysql_select_db($dbName, $link); < -apparently this isnt valid SQL does anyone know of a replacement line please?
$query = "select * from " . $table_name;
$ressult = mysql_query($query, $connection) or die("**** off");
$num = mysql_num_rows($result);
if ($num != 0) {
$file= fopen("results.xml", "w");
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$_xml .="<site>\r\n";
while ($row = mysql_fetch_array($result)) {
if ($row["pageTitle"]) {
$_xml .="\t<page title=\"" . $row["pageTitle"] . "\">\r\n";
$_xml .="\t\t<file>" . $row["pageLink"] . "</file>\r\n";
$_xml .="\t</page>\r\n";
} else {
$_xml .="\t<page title=\"Nothing Returned\">\r\n";
$_xml .="\t\t<file>none</file>\r\n";
$_xml .="\t</page>\r\n";
} }
$_xml .="</site>";
fwrite($file, $_xml);
fclose($file);
echo "XML has been written. <a href=\"results.xml\">View the XML.</a>";
} else {
echo "No Records found";
} ?>
[QUOTE]<?php
$db_name = "wilkiesh_newone";
$connection = mysql_connect("localhost", "wilkiesh_johnboy", "johnboy") or die ("**** off");
$table_name = "name";
$db = mysql_select_db($dbName, $link); < -apparently this isnt valid SQL does anyone know of a replacement line please?
$query = "select * from " . $table_name;
$ressult = mysql_query($query, $connection) or die("**** off");
$num = mysql_num_rows($result);
if ($num != 0) {
$file= fopen("results.xml", "w");
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$_xml .="<site>\r\n";
while ($row = mysql_fetch_array($result)) {
if ($row["pageTitle"]) {
$_xml .="\t<page title=\"" . $row["pageTitle"] . "\">\r\n";
$_xml .="\t\t<file>" . $row["pageLink"] . "</file>\r\n";
$_xml .="\t</page>\r\n";
} else {
$_xml .="\t<page title=\"Nothing Returned\">\r\n";
$_xml .="\t\t<file>none</file>\r\n";
$_xml .="\t</page>\r\n";
} }
$_xml .="</site>";
fwrite($file, $_xml);
fclose($file);
echo "XML has been written. <a href=\"results.xml\">View the XML.</a>";
} else {
echo "No Records found";
} ?>