Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Multiple XML data sets

Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Hi

I want to create multiple XML datasets on one page. For example: 2 queries (php,mysql), 2 results. Then on the page where you define the datasets you normally add this:

<script type="text/javascript">
<!--
var dsEmployees = new Spry.Data.XMLDataSet("export.php", "company/employee");
//-->
</script>
Now, this works perfectly, but how can i add multiple datasets, for example:

<script type="text/javascript">
<!--
var dsEmployees = new Spry.Data.XMLDataSet("export.php", "company/employee");
var dsEmployees2 = new Spry.Data.XMLDataSet("export.php", "company2/employee2");
//-->

Once i add the second dataset, only the first one displays. Anybody have any ideas?

Thanks
</script>
TOPICS
Server side applications

Views

509
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

did you add the other dataset to the regions?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Yes, i created 2 connections (php,mysql) on the one page, exported the data to 2 seperate tables, but when i try and call both tables on the page where the datasets are defined (see my original post), only 1 appear. Even in DW CS4, when i want to add another spry dataset (XML) using the wizard, only the first one comes up, it doesn't even show 2 data sets.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Do you have a online url?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

No, but i can post the code?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Uhm i guess so. :)

can you also post a sample xml? also, are you using the latest version of Spry ? (1.6.1)

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Ok, here is the code that gets the data and exports it to XML:
Query 1:
=============================
mysql_select_db($database_conn_export, $conn_export);
$query_rsEmployees = "SELECT * FROM employees_emp";
$rsEmployees = mysql_query($query_rsEmployees, $conn_export) or die(mysql_error());
$row_rsEmployees = mysql_fetch_assoc($rsEmployees);
$totalRows_rsEmployees = mysql_num_rows($rsEmployees);

// Begin XMLExport rsEmployees
$xmlExportObj = new XMLExport();
$xmlExportObj->setRecordset($rsEmployees);
$xmlExportObj->addColumn("firstname_emp", "firstname");
$xmlExportObj->addColumn("lastname_emp", "lastname");
$xmlExportObj->addColumn("address_emp", "address");
$xmlExportObj->addColumn("salary_emp", "salary");
$xmlExportObj->setMaxRecords("ALL");
$xmlExportObj->setDBEncoding("ISO-8859-1");
$xmlExportObj->setXMLEncoding("ISO-8859-1");
$xmlExportObj->setXMLFormat("NODES");
$xmlExportObj->setRootNode("company");
$xmlExportObj->setRowNode("employee");
$xmlExportObj->Execute();
// End XMLExport rsEmployees
=============================
Query 2:
=============================

=============================
mysql_select_db($database_data_one, $data_one);
$query_mem_details = "SELECT * FROM wherever where mem='$mem_number'";
$mem_details = mysql_query($query_mem_details, $data_one) or die(mysql_error());
$row_mem_details = mysql_fetch_assoc($mem_details);
$totalRows_mem_details = mysql_num_rows($mem_details);

// Begin XMLExport Member Details
$xmlExportObj = new XMLExport();
$xmlExportObj->setRecordset($mem_details);
$xmlExportObj->addColumn("firstname", "firstname");
$xmlExportObj->addColumn("lastname", "lastname");
$xmlExportObj->setMaxRecords("ALL");
$xmlExportObj->setDBEncoding("ISO-8859-1");
$xmlExportObj->setXMLEncoding("ISO-8859-1");
$xmlExportObj->setXMLFormat("NODES");
$xmlExportObj->setRootNode("Member");
$xmlExportObj->setRowNode("Details");
$xmlExportObj->Execute();
// End XMLExport Member Details
=============================

And here is the page that calls these two datasets:

<script type="text/javascript">
<!--
var dsEmployees = new Spry.Data.XMLDataSet("export.php", "company/employee");
var mem_details = new Spry.Data.XMLDataSet("export.php", "Member/Details");
//-->

And only the first one appears.
</script>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

I was talking about the html of the page, containing the regions.. repeats or anything that doesn't show up... and the rendered xml, not the php query 😄

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

LATEST
But thats my whole problem, it doesn't even get that far, even if i add the html, repeats, regions etc.. it only shows the first table. Also if i open the source file (whith the php queries) it also only shows the first table, but nothing more than that.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines