You are here: PHP and MS Access + XML « PHP Programming Language « IT news, forums, messages
PHP and MS Access + XML

Posted by Damo on 11/29/06 20:31

Hi,
I have resords in an access database. I want to retrieve them using php
and generate an xml file with them. I can retrieve the records and
generate an xml file but the xml file contains no data.
This is the code im using:
PHP:

$query1="SELECT * FROM cust";
$result=odbc_exec($conn , $query1)or die("Query failed: $sql<br
/>Error: ".mysql_error()."<br />");


$xml = '';
$xml .= '<?xml version="1.0"?>'."\n";
$xml .= '<!DOCTYPE customer SYSTEM "customer.dtd">'."\n";
$xml .= '<shop>'."\n";

while($row = odbc_fetch_row($result))
{

$xml .= '<customer>'."\n";
$xml .= '<customerId>'.$row['custonerId'].'</customerId>'."\n";
$xml .= '<name>'.$row['name'].'</name>'."\n";
///$xml .= '<address>'."\n";
$xml .= '<addressline1>'.$row['address1'].'</addressline1>'."\n";
$xml .= '<addressline2>'.$row['address2'].'</addressline2>'."\n";
$xml .= '<addressline3>'.$row['address3'].'</addressline3>'."\n";
///$xml .= '</address>'."\n";
$xml .= '<phone>'.$row['phone'].'</phone>'."\n";

$xml .= '</customer>'."\n";

}
$xml .= '</shop>'."\n";
$xmlfile = "C:\\phpdev\\www\\jim\\customers.xml";
$myfile = fopen($xmlfile,"w+");
fwrite($myfile,$xml);
fclose($myfile);

odbc_close($conn);


and this is the XML it generates

<?xml version="1.0" ?>
<!DOCTYPE customer (View Source for full doctype...)>
- <shop>
- <customer>
<customerId />
<name />
<addressline1 />
<addressline2 />
<addressline3 />
<phone />
</customer>

Theres no data for name address etc...

Anyone know why?
Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация