Spry XML dataset does not load

Posted on 2009-12-27
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.  

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

Question by:DanielAttard
    LVL 70

    Accepted Solution

    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
    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.

    Author Comment

    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?  
    LVL 70

    Expert Comment

    by:Jason C. Levine
    >> 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?

    Author Comment

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

    Expert Comment

    by:Jason C. Levine
    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now