mint suite
06-22-2006, 05:56 PM
I've built a page that creates an array from php using javascript (this will eventually go into a slideshow script).
The array displays on the page but the page continues to load - the hourglass doesn't go away.
Do I need to put a stop somewhere?
Here's the page:
<?php
// Performing SQL query
$query = 'SELECT * FROM photographers ORDER BY photo_id LIMIT 10 ';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
//var for hold data javascript array
$javascriptarray= " <script language=\"javascript\">phpjavasarr = new Array();"."\n";
//we need counter
$iC=0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$col_value=htmlentities($line["first_name"]);
/*$col_value=htmlentities("<a href='http://www.google.com'>".$line[first_name]."</a>"]);*/
$javascriptarray.= "phpjavasarr[$iC]=\"$col_value\";"."\n";
$iC++;
}
//end of javscript and simple example show quote
$javascriptarray.="
function showquote() {
var x=0;
for (x=0; x<$iC; x++)
{
document.write(phpjavasarr[x]);
}
}
</script>";
//print it
echo $javascriptarray;
?>
</head>
<body >
<a href="javascript:showquote()">show names</a>
</body>
The array displays on the page but the page continues to load - the hourglass doesn't go away.
Do I need to put a stop somewhere?
Here's the page:
<?php
// Performing SQL query
$query = 'SELECT * FROM photographers ORDER BY photo_id LIMIT 10 ';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
//var for hold data javascript array
$javascriptarray= " <script language=\"javascript\">phpjavasarr = new Array();"."\n";
//we need counter
$iC=0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$col_value=htmlentities($line["first_name"]);
/*$col_value=htmlentities("<a href='http://www.google.com'>".$line[first_name]."</a>"]);*/
$javascriptarray.= "phpjavasarr[$iC]=\"$col_value\";"."\n";
$iC++;
}
//end of javscript and simple example show quote
$javascriptarray.="
function showquote() {
var x=0;
for (x=0; x<$iC; x++)
{
document.write(phpjavasarr[x]);
}
}
</script>";
//print it
echo $javascriptarray;
?>
</head>
<body >
<a href="javascript:showquote()">show names</a>
</body>