Hi there:
I cannot get the code below to work properly. It works fine on the first loop but the next times around "$querySQL = 'SELECT * FROM host_index'" returns the wrong value.
Can somebody help me out?
[php]
<?php
require_once('c onnections/radiolightstrea m.php');
mysql_select_db ($database_radi olightstream, $radiolightstre am);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitl ed Document</title>
<SCRIPT LANGUAGE="JavaS cript">
<SCRIPT LANGUAGE="JavaS cript">
// ***** Modify the messages here ***** //
var Message = new Array(3);
Message[0]=
"<?php
$querySQL = 'SELECT * FROM host_index'; // get next host index
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$row_result = mysql_fetch_arr ay ($result);
echo $row_result['next_host'].'<p>';
$host_id = $row_result['next_host'] + 1; // actual host id
?>";
Message[1]=
"<?php
$querySQL = 'SELECT * FROM hosts WHERE approved=1 AND paid=1';
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$num_hosts = mysql_numrows($ result);
mysql_data_seek ($result, $row_result['next_host']) or die(mysql_error ());
$row_host_resul t = mysql_fetch_arr ay ($result);
echo $row_host_resul t[show_title].'<p>';
?>";
Message[2]=
'<?php
$next_host = $host_id % $num_hosts; // update pointer
$querySQL = "UPDATE host_index SET next_host=$next _host";
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
echo $querySQL."<p>" ;
?>';
var nCount = 0;
function rotateSpan1()
{
Span1.innerHTML =Message[nCount];
nCount++;
if(nCount>Messa ge.length-1) nCount=0;
setTimeout("rot ateSpan1()",500 0);
}
function showSpan1(obj)
{
Span1.innerHTML =obj
}
</SCRIPT>
</head>
<body>
<div id=Span1></div>
<SCRIPT LANGUAGE="JavaS cript">
rotateSpan1();
</SCRIPT>
</body>
</html>[/php]
Genia
I cannot get the code below to work properly. It works fine on the first loop but the next times around "$querySQL = 'SELECT * FROM host_index'" returns the wrong value.
Can somebody help me out?
[php]
<?php
require_once('c onnections/radiolightstrea m.php');
mysql_select_db ($database_radi olightstream, $radiolightstre am);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitl ed Document</title>
<SCRIPT LANGUAGE="JavaS cript">
<SCRIPT LANGUAGE="JavaS cript">
// ***** Modify the messages here ***** //
var Message = new Array(3);
Message[0]=
"<?php
$querySQL = 'SELECT * FROM host_index'; // get next host index
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$row_result = mysql_fetch_arr ay ($result);
echo $row_result['next_host'].'<p>';
$host_id = $row_result['next_host'] + 1; // actual host id
?>";
Message[1]=
"<?php
$querySQL = 'SELECT * FROM hosts WHERE approved=1 AND paid=1';
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
$num_hosts = mysql_numrows($ result);
mysql_data_seek ($result, $row_result['next_host']) or die(mysql_error ());
$row_host_resul t = mysql_fetch_arr ay ($result);
echo $row_host_resul t[show_title].'<p>';
?>";
Message[2]=
'<?php
$next_host = $host_id % $num_hosts; // update pointer
$querySQL = "UPDATE host_index SET next_host=$next _host";
$result = mysql_query($qu erySQL, $radiolightstre am) or die(mysql_error ());
echo $querySQL."<p>" ;
?>';
var nCount = 0;
function rotateSpan1()
{
Span1.innerHTML =Message[nCount];
nCount++;
if(nCount>Messa ge.length-1) nCount=0;
setTimeout("rot ateSpan1()",500 0);
}
function showSpan1(obj)
{
Span1.innerHTML =obj
}
</SCRIPT>
</head>
<body>
<div id=Span1></div>
<SCRIPT LANGUAGE="JavaS cript">
rotateSpan1();
</SCRIPT>
</body>
</html>[/php]
Genia
Comment