Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Klaus Kohlschuetter on Dec 09, 2008 04:50
open dhtmlx forum
Can't get the right xml return code for myDataProcessor

Hi,

I'm stil have problems with server side returns (creating the right xml code).
Everything works fine and the database makes the rigth operation but I can't get a correct response.

See server side code for example:
<?php

include("./configs/connect.cfg.php");

/**
* connect database
*/
$opdDB = mysql_connect( DB_HOST, DB_USER, DB_PASS ) or die(mysql_error());
mysql_select_db( DB_NAME ) or die(mysql_error());

$id = explode( "_", $_POST['gr_id'] );
$usrID = $id[0];
$Kundennr = $id[1];
$Warengruppe = $id[2];
$response = $_POST['gr_id'];

/*
* Prüfen, ob schon ein Eintrag vorhanden ist.
*/
$query = "SELECT count(*) FROM `potentials`
WHERE `usrID` = '".$usrID."' AND
`Kundennr` = '".$Kundennr."' AND
     `Warengruppe` = '".$Warengruppe."'";
                                
$result = mysql_query( $query ) or die(mysql_error());
$total = mysql_result( $result, 0 );

if ( $total ) {
// record available, change it
$query = "UPDATE potentials
SET `Menge` = '".$_POST['c1']."'
    WHERE
    `usrID` = '".$usrID."' AND
    `Kundennr` = '".$Kundennr."' AND
    `Warengruppe` = '".$Warengruppe."'";
                            
    $result = mysql_query( $query ) or die( mysql_error());
    
} else {
// no entry available, create a new one
$query = "INSERT INTO `potentials` (
    `usrID`,`Kundennr`,`Warengruppe`,`Menge`
    ) VALUES (
    '".$usrID."',
    '".$Kundennr."',
    '".$Warengruppe."',
    '".$_POST['c1']."'
                         )";
    $result = mysql_query( $query ) or die(mysql_error());
}

/**
* close database
*/
mysql_close( $opdDB );

/**
* Send response
*/
print("<data><action type='update' sid='".$response."' tid='".$response."' /></data>");

?>

The answer from your dubug tool looks like
Server url: update.php?

gr_id=3_4060-01_FOB%20ERTR
c0=FOB%20ERTR
c1=5000
c2=0

server response received <data><action type='update' sid='3_4060-01_FOB%20ERTR' tid='3_4060-01_FOB%20ERTR' /></data>
Not a XML

What is wrong?
Many thanks for your help.

KK
Answer posted by Support on Dec 09, 2008 05:10
You need to return the data as XML stream, try to add next line to your php file

header("Content-type:text/xml");
Answer posted by Klaus Kohlschuetter on Dec 09, 2008 05:15
I'm so sory, but it does'nt work. Allways the same error message in debug mode.
Answer posted by Support on Dec 09, 2008 05:45
Please try to update debug js file with attached one.
Attachments (1)
Answer posted by Klaus Kohlschuetter on Dec 09, 2008 05:58

Now it works fine.

By the way: Your tool is a perfect development environment for web apllications and I'm happy deciding me for your product.

But one additional question:
Do you plan a nationalisation of that tool. I'm working in different projects for different countries and so it would be great to have the opportunity to choose e.g. currency signs?

Kind regards
Klaus

Answer posted by Support on Dec 09, 2008 06:09
The code of component is created in a way which must simplify customization for different settings. 
The only hardcoded text lines stored by component ( except of debug messages ) are texts in paging mode, which can be configured separatly
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_paging.html#grid_art_custpaging


The currency char is hardcoded as part of "price" excell, but you can use "edn" instead of it, which allows to define any custom pre|post-fix 

mygrid.setColTypes("edn,...
mygrid.setNumberFormat("$ 0.00",0);
or 
mygrid.setNumberFormat("¥ 0.00",0);
or 
mygrid.setNumberFormat("0.00 ˆ",0);
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Cell_values_formating.html#grid_art_formatcells