RE: QUERY2XML problem with data type
| From: | Lukas Feiler | Date: | Tue, 06 Nov 2007 03:13:31 +0000 |
| Subject: | RE: QUERY2XML problem with data type | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28163@lists.php.net to get a copy of this message | ||
Hi Bruno!
your mail should also have gone to <mailto:pear-general@lists.php.net>
pear-general@lists.php.net.
I doubt this has anything to do with XML_Query2XML.
What's the data type of the database column in question? Could it be that it
is an INT instead of VARCHAR?
Lukas
-----Original Message-----
From: SENART Bruno [mailto:elelikool@gmail.com]
Sent: Monday, November 05, 2007 7:29 AM
To: lukas.feiler@lukasfeiler.com
Subject: QUERY2XML problem with data type
Hi Lukas, I am a very new user of PHP and PEAR. I wish to extract data from
my MySql database to XML using PHP, QUERY2XML seems very indicated.
this is one of my scripts :
<?php
require('params.php');
require_once 'XML/Query2XML.php';
require_once 'MDB2.php';
$query2xml = XML_Query2XML::factory( MDB2::factory(
'mysqli://'.$user.':'.$pass.
'@'.$host.'/'.$db))
;
$req="SELECT eccnum, ecccll, eccjjc, eccmmc,
eccaac, eccal1, eccclv, eccca,
ecctcd, id
FROM cophyecc
WHERE stgrp= 1 and stdos= 50 and eccsec=1
ORDER BY id desc";
$req=$req. " limit 0, " .$_GET[
"nblig"];
$options=array(
'rootTag' =>
'COMMANDES_CLIENT',
'rowTag' => 'COMMANDE_CLIENT',
'idColumn' => 'eccnum',
'attributes' => array
(
'numero' => 'eccnum',
'num_fac' =>
'eccfac',
'rs_cli' => 'eccal1',
'adr_liv' => 'eccclv',
'type' => 'eccca'
,
'montant' => 'ecctcd',
'jour' =>
'eccjjc',
'mois' => 'eccmmc',
'annee' => 'eccaac',
'num_cli' =>
'ecccll',
'num_lig' => 'id'
)
);
$dom = $query2xml->getXML
( $req, $options);
header('Content-Type: application/xml'
);
$dom->formatOutput = true;
print
$dom->saveXML();
?>
When I extract a number, from an "alpha numerical" field, which begins with
the zero number,the first digit "zero" disappear. For example a reference
"0111434" is transformed is recognized as the number "111434" and the zero
is removed, therfore we are not talking about the correct reference anymore.
If I make a "print_r ($record)" the fields are restored with the numerical
format. Where and how to prevent that. Is it necessary to indicated to MDB2
the type of the fields ? Where and how do this.
Thank you for reply