Spry XML dataset does not load

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

DanielAttardAsked:
Who is Participating?
 
Jason C. LevineNo oneCommented:
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
 
DanielAttardAuthor Commented:
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
 
Jason C. LevineNo oneCommented:
>> 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
 
DanielAttardAuthor Commented:
Hi Jason - How can I filter at the PHP/MySQL level?  Can I do this dynamically so that it happens at runtime?
0
 
Jason C. LevineNo oneCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.