PHP and MS Access + XML

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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:

$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+");


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 />

Theres no data for name address etc...

Anyone know why?

Re: PHP and MS Access + XML

Try setting error_reporting(E_ALL) at the top of the script; maybe some
notices will be generated. For instance, this might be a typo:


Damo wrote:
Quoted text here. Click to load it

Site Timeline