November 17, 2008

Failed to access IIS metabase.

This error typically occurs when you install IIS after you have asp.net installed. It is a very simple fix.

Copy and paste this into the Run Command from the Start Menu.
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

November 02, 2008

Transfer PHP to XML

This function below is used to transfer the select statement of Mysql into XML file.
================================
function tbl_xml($sql,$tbl_name){
$ds =mysql_query($sql);
if(!$ds){
die("mysql error ". mysql_error());
}
//xml declaration
$dom= new DOMDocument("1.0");
$xml_root=$dom->appendChild($dom->createElement("$tbl_name"));
$n_row=0;
while($row=mysql_fetch_array($ds)){
$n_field=0;
$fieldname=$xml_root->appendChild($dom->createElement("field"));
while($n_field<mysql_num_fields($ds)){
$field=mysql_fetch_field($ds,$n_field);
//$fieldname->appendChild($dom->createTextNode($row[$field->name]));
$fieldname->setAttribute($field->name,$row[$field->name]);
$n_field++;
}
$n_row++;
}
$dom->formatOutput=true;
$dom->save("$tbl_name.xml");
}