Soldato
- Joined
- 31 Oct 2005
- Posts
- 8,845
- Location
- Leeds
Hi there again, should be a quick simple answer to this
I have a PHP page that takes my SQL database and outputs it as an XML file
I then want to transform the XML using XSL, I already have the XSL file
this is my PHP file
I have the line
I need to include that somewhere in the above PHP script, whereabouts would I place it? Many thanks
I have a PHP page that takes my SQL database and outputs it as an XML file
I then want to transform the XML using XSL, I already have the XSL file
this is my PHP file
<?php
header("Content-type: text/xml");
$host = "mysql4.hehe.com";
$user = "not seeing my pass";
$pass = "not ever";
$database = "nah";
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM a5168769_cust";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<entries>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<username>\n";
$xml_output .= "\t\t<username>" . $row['username'] . "</username>\n";
// Escaping illegal characters
$row['text'] = str_replace("&", "&", $row['text']);
$row['text'] = str_replace("<", "<", $row['text']);
$row['text'] = str_replace(">", ">", $row['text']);
$row['text'] = str_replace("\"", """, $row['text']);
$xml_output .= "\t\t<password>" . $row['password'] . "</password>\n";
$xml_output .= "\t</username>\n";
}
$xml_output .= "</entries>";
echo $xml_output;
?>
I have the line
<?xml-stylesheet type="text/xsl" href="inn.xsl"?>
I need to include that somewhere in the above PHP script, whereabouts would I place it? Many thanks