0x80040400:QuickBooks在PHP quickbooks中解析提供的XML文本流时发现错误

时间:2017-09-26 15:27:07

标签: php quickbooks

我哪里错了?

function _quickbooks_customer_add_request($requestID, $user, $action, $ID, 
    $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
// Grab the data from our MySQL database
//$arr = mysql_fetch_assoc(mysql_query("SELECT * FROM q_firms WHERE id = '$firm_id'"));

$query = "SELECT 
                        DISTINCT (q_firms.firm_id), q_firms.firm, q_firms.status,
                        q_offices.address1, q_offices.address2, q_offices.city, q_offices.state, q_offices.zip, q_offices.country, q_offices.phone as office_phone, q_offices.fax as office_fax,
                        q_users.first, q_users.middle, q_users.last, q_users.title, q_users.email, q_users.phone, q_users.fax
                    FROM 
                        (q_firms)
                    LEFT JOIN 
                        q_offices ON q_offices.office_id=q_firms.main_office
                    LEFT JOIN 
                        q_users ON q_users.firm_id=q_firms.firm_id AND q_users.b_contact='Y'
                    WHERE q_firms.firm_id='$firm_id'";

            $query1 = mysql_query($query);

 $arr = mysql_fetch_array($query1);



$xml = '<?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="2.0"?>
    <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
            <CustomerAddRq requestID="' . $arr['firm_id']. '">
                <CustomerAdd>
                    <Name>' . $arr['firm'] . '</Name>
                    <CompanyName>' . $arr['firm'] . '</CompanyName>
                    <FirstName>' . $arr['first'] . '</FirstName>
                    <LastName>' . $arr['last'] . '</LastName>
                    <BillAddress>
                        <Addr1>' . $arr['address1'] . '</Addr1>
                        <Addr2>' . $arr['address2'] . '</Addr2>
                        <City>' . $arr['city'] . '</City>
                        <State>' . $arr['state'] . '</State>
                        <PostalCode>' . $arr['zip'] . '</PostalCode>
                        <Country>' . $arr['country'] . '</Country>
                    </BillAddress>
                </CustomerAdd>
            </CustomerAddRq>
        </QBXMLMsgsRq>
    </QBXML>';



return $xml;
}

0 个答案:

没有答案