Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Spry XML dataset does not load

Posted on 2009-12-27
5
Medium Priority
?
357 Views
Last Modified: 2012-06-27
I am using the Spry.Data.PagedView class to control the paging of data in a data set.  The data set I am using is XML which is generated dynamically using the PHP file shown below.  Normally, this dataset returns about 10,000 rows.  This is the first time I am trying to use such a large data set in a Spry.Data.PagedView and it does not seem to load.  If I artificially limit the data set to less than about 1,000 records it works.  As soon as the data set gets too large, the paged view will not load.

Are there limitations on how many records I can use in a Spry.Data.PagedView class?  If so, how can I work around this?  Is there a way that I can pass a variable into the PHP file so that it filters for the required records at runtime?

Any ideas appreciated.  
<?php 

header("Content-type: text/xml"); 

$host = "localhost"; 
$user = "root"; 
$pass = "root"; 
$database = "mydatabase"; 

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); 
mysql_select_db($database, $linkID) or die("Could not find database."); 

$query = "SELECT * FROM tblproperties WHERE P_ContactID>9000;";

$resultID = mysql_query($query, $linkID) or die("Data not found."); 

$xml_output = "<?xml version=\"1.0\"?>\n"; 
echo $xml_output."<optc>\n"; 
while ($line = mysql_fetch_assoc($resultID) ) {
  echo "<record>\n";
  foreach($line as $key=>$value)
  	  echo "  <$key>". htmlspecialchars($value) . "</$key>\n";	
  echo "</record>\n";
}
echo '</optc>'; 
?>

Open in new window

0
Comment
Question by:DanielAttard
  • 3
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 2000 total points
ID: 26129269
Hi Daniel,

There should be no real limit on how many records come back. The only things I can think of are:

1. The script is timing out before it can return all of the records
or
2. There is some text in the XML data that breaks the file and causes the browsers to choke.  

I would lean towards #2 at this point. You should output your XML data as a separate file and run it through an XML validator to see if there are any errors.
0
 

Author Comment

by:DanielAttard
ID: 26129464
Thanks for the input Jason.  I'm beginning to realize that even though it might be technically possible to load the entire XML file, this might not be the best solution for what I am trying to do since the XML file is 8MB in size.  This would mean that every time the page loads, it would have to load 8MB of data.  Obviously, that's not a good solution.

Is there some other way that I can dynamically filter the XML file at runtime?  How can I pass a variable that will filter the XML data?  
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26129648
>> since the XML file is 8MB in size

Ouch.  I revert to my #1, then.  The PHP script is probably timing out on you.  

>> I can dynamically filter the XML file at runtime

Easier to filter at the PHP/MySQL level or is that not an option for you?
0
 

Author Comment

by:DanielAttard
ID: 26159536
Hi Jason - How can I filter at the PHP/MySQL level?  Can I do this dynamically so that it happens at runtime?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26159919
Yes you can filter the SQL query based on any input from the site (form post, URL variable, cookies value, session value). This occurs as the query is executed so it is runtime by default.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question