Question : hundreds of mysql entries causing lag

is there anyway I can have this code load in groups of 6 rather than loading the entire database of over 900 at once.  It is causing a lag effect in my flash swf  thanks.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
<?php
// -------------------------------------------------------------------
header("Content-Type: text/xml"); //set the content type to xml
// Initialize the xmlOutput variable
$xmlBody .= "";
$xmlBody .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
<atom:link href=\"http://www.kevinjsimmons.com/ticker/tickerstock.php\" rel=\"self\" type=\"application/rss+xml\" />
<title>My Urban Report</title>
<link>http://www.yourwebsite.com/</link>
<description>Welcome to My Urban Report Feed. </description>
<language>en-us</language>
<copyright>@2010 www.yourwebsite.com</copyright>
<lastBuildDate>Tue, 04 Nov 2008 12:48:12 -0800</lastBuildDate>
<image>
<url>http://www.yourwebsite.com/logofile.png</url>
<title>vStock Ticker</title>
<link>http://www.yourwebsite.com/</link>
<width>81</width>
<height>33</height>
</image>
"; 
// Connect to your MySQL database whatever way you like to here
include_once "../scripts/connect_to_mysql.php";
// Execute the Query on the database to select items(20 in this example)
$sql = mysql_query("SELECT * FROM stock_index ORDER BY Current_Value DESC");
while($row = mysql_fetch_array($sql)){
    // Set DB variables into local variables for easier use 
    $Full_Name = $row["Full_Name"];
	$Symbol = $row["Symbol"];
	$Current_Value = $row["Current_Value"];
	$date = $row["pubDate"];
	$description = $row["description"];
	

    // Start filling the $xmlBody variable with looping content here inside the while loop 
    // It will loop through 20 items from the database and render into XML format
    $xmlBody .= "
<item> 
    <title>$Full_Name $Symbol $Current_Value</title>
	<link>http://www.yourwebsite.com/</link> 
</item>
";
} // Close while loop
// Close channel and rss tags
$xmlBody .= "</channel>
</rss>"; 
// Print the nice clean PHP XML
print "$xmlBody";
exit(); // Exit script 
?>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
<?php
// -------------------------------------------------------------------
header("Content-Type: text/xml"); //set the content type to xml
// Initialize the xmlOutput variable
$xmlBody .= "";
$xmlBody .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
<atom:link href=\"http://www.kevinjsimmons.com/ticker/tickerstock.php\" rel=\"self\" type=\"application/rss+xml\" />
<title>My Urban Report</title>
<link>http://www.yourwebsite.com/</link>
<description>Welcome to My Urban Report Feed. </description>
<language>en-us</language>
<copyright>@2010 www.yourwebsite.com</copyright>
<lastBuildDate>Tue, 04 Nov 2008 12:48:12 -0800</lastBuildDate>
<image>
<url>http://www.yourwebsite.com/logofile.png</url>
<title>vStock Ticker</title>
<link>http://www.yourwebsite.com/</link>
<width>81</width>
<height>33</height>
</image>
"; 
// Connect to your MySQL database whatever way you like to here
include_once "../scripts/connect_to_mysql.php";
// Execute the Query on the database to select items(20 in this example)
$sql = mysql_query("SELECT * FROM stock_index ORDER BY Current_Value DESC");
while($row = mysql_fetch_array($sql)){
    // Set DB variables into local variables for easier use 
    $Full_Name = $row["Full_Name"];
	$Symbol = $row["Symbol"];
	$Current_Value = $row["Current_Value"];
	$date = $row["pubDate"];
	$description = $row["description"];
	

    // Start filling the $xmlBody variable with looping content here inside the while loop 
    // It will loop through 20 items from the database and render into XML format
    $xmlBody .= "
<item> 
    <title>$Full_Name $Symbol $Current_Value</title>
	<link>http://www.yourwebsite.com/</link> 
</item>
";
} // Close while loop
// Close channel and rss tags
$xmlBody .= "</channel>
</rss>"; 
// Print the nice clean PHP XML
print "$xmlBody";
exit(); // Exit script 
?>

Answer : hundreds of mysql entries causing lag

It never loads it seems. Just a black screen. I don't know why that is happening but I assume you are just loading in the rss feed into the flash? you will have to debug the flash to see what is happening but I don't know enough about flash to help with that
Random Solutions  
 
programming4us programming4us